diff --git a/src/de/mas/wiiu/jnus/implementations/wud/reader/WUDDiscReader.java b/src/de/mas/wiiu/jnus/implementations/wud/reader/WUDDiscReader.java index e28c556..a01bc63 100644 --- a/src/de/mas/wiiu/jnus/implementations/wud/reader/WUDDiscReader.java +++ b/src/de/mas/wiiu/jnus/implementations/wud/reader/WUDDiscReader.java @@ -57,8 +57,8 @@ public abstract class WUDDiscReader { public abstract boolean readEncryptedToStream(OutputStream out, long offset, long size) throws IOException; public InputStream readEncryptedToStream(long offset, long size) throws IOException { - PipedInputStreamWithException in = new PipedInputStreamWithException(); - PipedOutputStream out = new PipedOutputStream(in); + PipedOutputStream out = new PipedOutputStream(); + PipedInputStreamWithException in = new PipedInputStreamWithException(out, 0x8000); new Thread(() -> { try { diff --git a/src/de/mas/wiiu/jnus/interfaces/FSTDataProvider.java b/src/de/mas/wiiu/jnus/interfaces/FSTDataProvider.java index b1fb12d..5c10135 100644 --- a/src/de/mas/wiiu/jnus/interfaces/FSTDataProvider.java +++ b/src/de/mas/wiiu/jnus/interfaces/FSTDataProvider.java @@ -36,14 +36,13 @@ public interface FSTDataProvider { 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 size) throws IOException { - PipedInputStreamWithException in = new PipedInputStreamWithException(); - PipedOutputStream out = new PipedOutputStream(in); + PipedOutputStream out = new PipedOutputStream(); + PipedInputStreamWithException in = new PipedInputStreamWithException(out, 0x10000); new Thread(() -> { try { @@ -63,6 +62,4 @@ public interface FSTDataProvider { public boolean readFileToStream(OutputStream out, FSTEntry entry, long offset, Optional size) throws IOException; - - } diff --git a/src/de/mas/wiiu/jnus/utils/PipedInputStreamWithException.java b/src/de/mas/wiiu/jnus/utils/PipedInputStreamWithException.java index 1fff75f..86a27f1 100644 --- a/src/de/mas/wiiu/jnus/utils/PipedInputStreamWithException.java +++ b/src/de/mas/wiiu/jnus/utils/PipedInputStreamWithException.java @@ -18,6 +18,7 @@ package de.mas.wiiu.jnus.utils; import java.io.IOException; import java.io.PipedInputStream; +import java.io.PipedOutputStream; import de.mas.wiiu.jnus.interfaces.InputStreamWithException; import lombok.extern.java.Log; @@ -29,6 +30,14 @@ public class PipedInputStreamWithException extends PipedInputStream implements I private boolean closed = false; private Object lock = new Object(); + public PipedInputStreamWithException() { + + } + + public PipedInputStreamWithException(PipedOutputStream src, int pipeSize) throws IOException { + super(src, pipeSize); + } + @Override public void close() throws IOException { super.close();