Build fix, HBASE-3514

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1082342 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Ryan Rawson 2011-03-16 23:18:51 +00:00
parent 9f6c65f54e
commit 75593fc93a
2 changed files with 8 additions and 12 deletions

View File

@ -90,7 +90,9 @@ public class ByteBufferOutputStream extends OutputStream {
*/
public synchronized void writeTo(OutputStream out) throws IOException {
WritableByteChannel channel = Channels.newChannel(out);
channel.write(getByteBuffer());
ByteBuffer bb = buf.duplicate();
bb.flip();
channel.write(bb);
}
@Override
@ -118,18 +120,13 @@ public class ByteBufferOutputStream extends OutputStream {
}
public byte[] toByteArray(int offset, int length) {
int position = buf.position();
byte[] chunk;
ByteBuffer bb = buf.duplicate();
bb.flip();
try {
buf.position(offset);
chunk = new byte[length];
buf.get(chunk, 0, length);
} finally {
buf.position(position);
}
byte[] chunk = new byte[length];
bb.position(offset);
bb.get(chunk, 0, length);
return chunk;
}
}

View File

@ -702,7 +702,6 @@ public class TestStoreFile extends HBaseTestCase {
while ((kv1 = scannerOne.next()) != null) {
kv2 = scannerTwo.next();
assertTrue(kv1.equals(kv2));
assertTrue(Bytes.equals(kv1.getBuffer(), kv2.getBuffer()));
}
assertNull(scannerTwo.next());
assertEquals(startHit + 6, cs.getHitCount());