Merge branch 'master' into 'master'
Improve project unzipping performance See merge request sheepitrenderfarm/client!329
This commit is contained in:
@@ -51,4 +51,25 @@ public class ChunkInputStream extends InputStream {
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Improve throughput by offering method to read whole block of bytes at once
|
||||||
|
@Override public int read(byte[] b, int off, int len) throws IOException {
|
||||||
|
int bytesRead = -1;
|
||||||
|
|
||||||
|
while (bytesRead == -1) {
|
||||||
|
bytesRead = currentStream.read(b, off, len);
|
||||||
|
|
||||||
|
if (bytesRead == -1) {
|
||||||
|
try {
|
||||||
|
prepareNextChunk();
|
||||||
|
}
|
||||||
|
catch (NoSuchElementException e) {
|
||||||
|
/// This was the last chunk
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return bytesRead;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user