Format format();
/**
+ * Returns the metadata of this source.
+ *
+ * @return The metadata of this source
+ */
+ Metadata metadata();
+
+ /**
* Retrieves the given name of bytes from this source. The source should always
* try to read as much data as was requested but is free to return a byte array
* with less elements that requested. However, the byte array will always be
import net.pterodactylus.sonitus.data.Connection;
import net.pterodactylus.sonitus.data.Filter;
import net.pterodactylus.sonitus.data.Format;
+import net.pterodactylus.sonitus.data.Metadata;
import net.pterodactylus.sonitus.data.Source;
import net.pterodactylus.sonitus.io.InputStreamDrainer;
}
@Override
+ public Metadata metadata() {
+ return source.metadata();
+ }
+
+ @Override
public byte[] get(int bufferSize) throws EOFException, IOException {
byte[] buffer = new byte[bufferSize];
int read = pipedInputStream.read(buffer);
import net.pterodactylus.sonitus.data.ConnectException;
import net.pterodactylus.sonitus.data.Filter;
import net.pterodactylus.sonitus.data.Format;
+import net.pterodactylus.sonitus.data.Metadata;
import net.pterodactylus.sonitus.data.ReusableSink;
import net.pterodactylus.sonitus.data.Source;
import net.pterodactylus.sonitus.data.event.SourceFinishedEvent;
}
@Override
+ public Metadata metadata() {
+ synchronized (syncObject) {
+ return connection.source.metadata();
+ }
+ }
+
+ @Override
public byte[] get(int bufferSize) throws EOFException, IOException {
byte[] buffer = new byte[bufferSize];
InputStream inputStream;
import net.pterodactylus.sonitus.data.Connection;
import net.pterodactylus.sonitus.data.Filter;
import net.pterodactylus.sonitus.data.Format;
+import net.pterodactylus.sonitus.data.Metadata;
import net.pterodactylus.sonitus.data.Source;
import com.google.common.base.Preconditions;
}
@Override
+ public Metadata metadata() {
+ return source.metadata();
+ }
+
+ @Override
public byte[] get(int bufferSize) throws EOFException, IOException {
byte[] buffer = new byte[bufferSize];
int read = pipedInputStream.read(buffer);
import java.util.Arrays;
import net.pterodactylus.sonitus.data.Format;
+import net.pterodactylus.sonitus.data.Metadata;
import net.pterodactylus.sonitus.data.Source;
import net.pterodactylus.sonitus.io.IdentifyingInputStream;
}
@Override
+ public Metadata metadata() {
+ return new Metadata().name(path);
+ }
+
+ @Override
public byte[] get(int bufferSize) throws IOException {
byte[] buffer = new byte[bufferSize];
int read = ByteStreams.read(fileInputStream, buffer, 0, bufferSize);