mirror of
https://github.com/Maschell/JNUSLib.git
synced 2024-11-22 16:09:18 +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);
|
System.arraycopy(overflowbuf, 0, output, inBlockBuffer, toRead);
|
||||||
inBlockBuffer += toRead;
|
inBlockBuffer += toRead;
|
||||||
|
|
||||||
System.arraycopy(overflowbuf, toRead, overflowbuf, 0, tooMuch);
|
if (tooMuch > 0) {
|
||||||
overflowbuffer.setLengthOfDataInBuffer(tooMuch);
|
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 {
|
} else {
|
||||||
System.arraycopy(overflowbuf, 0, output, inBlockBuffer, overflowbuffer.getLengthOfDataInBuffer());
|
System.arraycopy(overflowbuf, 0, output, inBlockBuffer, overflowbuffer.getLengthOfDataInBuffer());
|
||||||
inBlockBuffer += overflowbuffer.getLengthOfDataInBuffer();
|
inBlockBuffer += overflowbuffer.getLengthOfDataInBuffer();
|
||||||
|
Loading…
Reference in New Issue
Block a user