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:
Joel Dice
2012-09-14 11:40:26 -06:00
parent 3a5abaf58a
commit 2d9bbec214
2 changed files with 11 additions and 4 deletions

View File

@ -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;
}