mirror of
https://github.com/corda/corda.git
synced 2025-01-05 20:54:13 +00:00
Merge branch 'master' of dice:git/vm
This commit is contained in:
commit
fb36d7c605
@ -19,6 +19,19 @@ public class ByteArrayInputStream extends InputStream {
|
||||
}
|
||||
}
|
||||
|
||||
public int read(byte[] buffer, int offset, int bufferLength) {
|
||||
if (position >= length) {
|
||||
return -1;
|
||||
}
|
||||
int remaining = length-position;
|
||||
if (remaining < bufferLength) {
|
||||
bufferLength = remaining;
|
||||
}
|
||||
System.arraycopy(array, position, buffer, offset, bufferLength);
|
||||
position += bufferLength;
|
||||
return bufferLength;
|
||||
}
|
||||
|
||||
public int available() {
|
||||
return length - position;
|
||||
}
|
||||
|
@ -201,4 +201,8 @@ public class ByteBuffer {
|
||||
if (position < 0 || position+amount > limit)
|
||||
throw new IndexOutOfBoundsException();
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "(ByteBuffer with array: " + array + " arrayOffset: " + arrayOffset + " position: " + position + " remaining; " + remaining() + ")";
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user