mirror of
https://github.com/corda/corda.git
synced 2025-06-14 13:18:18 +00:00
fix a couple of ByteBuffer regressions
The compact() and put(ByteBuffer) methods regressed as of the recent refactoring to support direct byte buffers.
This commit is contained in:
@ -31,6 +31,10 @@ class ArrayByteBuffer extends ByteBuffer {
|
||||
return b;
|
||||
}
|
||||
|
||||
public boolean hasArray() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public byte[] array() {
|
||||
return array;
|
||||
}
|
||||
@ -49,9 +53,10 @@ class ArrayByteBuffer extends ByteBuffer {
|
||||
}
|
||||
|
||||
public ByteBuffer put(ByteBuffer src) {
|
||||
checkPut(position, src.remaining());
|
||||
src.get(array, arrayOffset + position, src.remaining());
|
||||
position += src.remaining();
|
||||
int length = src.remaining();
|
||||
checkPut(position, length);
|
||||
src.get(array, arrayOffset + position, length);
|
||||
position += length;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user