Add simple wrapper for the "readFileAsStream" function of the FSTDataProvider

This commit is contained in:
Maschell 2019-04-14 20:39:37 +02:00
parent 151ad6e2a6
commit 54536f29ab

View File

@ -36,6 +36,11 @@ public interface FSTDataProvider {
public byte[] readFile(FSTEntry entry, long offset, long size) throws IOException; public byte[] readFile(FSTEntry entry, long offset, long size) throws IOException;
default public InputStream readFileAsStream(FSTEntry entry) throws IOException {
return readFileAsStream(entry, 0, Optional.empty());
}
default public InputStream readFileAsStream(FSTEntry entry, long offset, Optional<Long> size) throws IOException { default public InputStream readFileAsStream(FSTEntry entry, long offset, Optional<Long> size) throws IOException {
PipedInputStreamWithException in = new PipedInputStreamWithException(); PipedInputStreamWithException in = new PipedInputStreamWithException();
PipedOutputStream out = new PipedOutputStream(in); PipedOutputStream out = new PipedOutputStream(in);
@ -58,4 +63,6 @@ public interface FSTDataProvider {
public void readFileToStream(OutputStream out, FSTEntry entry, long offset, Optional<Long> size) throws IOException; public void readFileToStream(OutputStream out, FSTEntry entry, long offset, Optional<Long> size) throws IOException;
} }