mirror of
https://github.com/Maschell/JNUSLib.git
synced 2024-11-25 17:36:55 +01:00
Fix a bug in the "getChunkOfStream" function
This commit is contained in:
parent
31fcc4fc6d
commit
7bd424ec42
@ -88,8 +88,17 @@ public final class StreamUtils {
|
||||
System.arraycopy(overflowbuf, 0, output, inBlockBuffer, toRead);
|
||||
inBlockBuffer += toRead;
|
||||
|
||||
if (tooMuch > 0) {
|
||||
System.arraycopy(overflowbuf, toRead, overflowbuf, 0, tooMuch);
|
||||
overflowbuffer.setLengthOfDataInBuffer(tooMuch);
|
||||
} else {
|
||||
// Moving into front.
|
||||
int missingLength = overflowbuffer.getLengthOfDataInBuffer() - toRead;
|
||||
if (missingLength > 0) {
|
||||
System.arraycopy(overflowbuf, toRead, overflowbuf, 0, missingLength);
|
||||
overflowbuffer.setLengthOfDataInBuffer(missingLength);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
System.arraycopy(overflowbuf, 0, output, inBlockBuffer, overflowbuffer.getLengthOfDataInBuffer());
|
||||
inBlockBuffer += overflowbuffer.getLengthOfDataInBuffer();
|
||||
|
Loading…
Reference in New Issue
Block a user