mirror of
https://github.com/corda/corda.git
synced 2025-01-08 14:03:06 +00:00
Optimize bulk reads from ByteArrayInputStream
This commit is contained in:
parent
958d39aa03
commit
df79f410f1
@ -19,6 +19,18 @@ public class ByteArrayInputStream extends InputStream {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int read(byte[] buffer, int offset, int bufferLength) {
|
||||||
|
if (position < length) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (length-position < bufferLength) {
|
||||||
|
bufferLength = length-position;
|
||||||
|
}
|
||||||
|
System.arraycopy(buffer, offset, array, position, bufferLength);
|
||||||
|
position += bufferLength;
|
||||||
|
return bufferLength;
|
||||||
|
}
|
||||||
|
|
||||||
public int available() {
|
public int available() {
|
||||||
return length - position;
|
return length - position;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user