mirror of
https://github.com/Maschell/JNUSLib.git
synced 2024-11-25 09:26:55 +01:00
Increase the size of the PipedStream buffers. This increases the performance.
This commit is contained in:
parent
1f02e9d41d
commit
0d39c037ad
@ -57,8 +57,8 @@ public abstract class WUDDiscReader {
|
|||||||
public abstract boolean readEncryptedToStream(OutputStream out, long offset, long size) throws IOException;
|
public abstract boolean readEncryptedToStream(OutputStream out, long offset, long size) throws IOException;
|
||||||
|
|
||||||
public InputStream readEncryptedToStream(long offset, long size) throws IOException {
|
public InputStream readEncryptedToStream(long offset, long size) throws IOException {
|
||||||
PipedInputStreamWithException in = new PipedInputStreamWithException();
|
PipedOutputStream out = new PipedOutputStream();
|
||||||
PipedOutputStream out = new PipedOutputStream(in);
|
PipedInputStreamWithException in = new PipedInputStreamWithException(out, 0x8000);
|
||||||
|
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
try {
|
try {
|
||||||
|
@ -36,14 +36,13 @@ 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 {
|
default public InputStream readFileAsStream(FSTEntry entry) throws IOException {
|
||||||
return readFileAsStream(entry, 0, Optional.empty());
|
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();
|
PipedOutputStream out = new PipedOutputStream();
|
||||||
PipedOutputStream out = new PipedOutputStream(in);
|
PipedInputStreamWithException in = new PipedInputStreamWithException(out, 0x10000);
|
||||||
|
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
try {
|
try {
|
||||||
@ -63,6 +62,4 @@ public interface FSTDataProvider {
|
|||||||
|
|
||||||
public boolean readFileToStream(OutputStream out, FSTEntry entry, long offset, Optional<Long> size) throws IOException;
|
public boolean readFileToStream(OutputStream out, FSTEntry entry, long offset, Optional<Long> size) throws IOException;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@ package de.mas.wiiu.jnus.utils;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.PipedInputStream;
|
import java.io.PipedInputStream;
|
||||||
|
import java.io.PipedOutputStream;
|
||||||
|
|
||||||
import de.mas.wiiu.jnus.interfaces.InputStreamWithException;
|
import de.mas.wiiu.jnus.interfaces.InputStreamWithException;
|
||||||
import lombok.extern.java.Log;
|
import lombok.extern.java.Log;
|
||||||
@ -29,6 +30,14 @@ public class PipedInputStreamWithException extends PipedInputStream implements I
|
|||||||
private boolean closed = false;
|
private boolean closed = false;
|
||||||
private Object lock = new Object();
|
private Object lock = new Object();
|
||||||
|
|
||||||
|
public PipedInputStreamWithException() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public PipedInputStreamWithException(PipedOutputStream src, int pipeSize) throws IOException {
|
||||||
|
super(src, pipeSize);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void close() throws IOException {
|
public void close() throws IOException {
|
||||||
super.close();
|
super.close();
|
||||||
|
Loading…
Reference in New Issue
Block a user