.../java/org/apache/hadoop/hbase/io/ByteBufferOutputStream.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/io/ByteBufferOutputStream.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/io/ByteBufferOutputStream.java index 55a4aac..257b850 100644 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/io/ByteBufferOutputStream.java +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/io/ByteBufferOutputStream.java @@ -70,8 +70,12 @@ public class ByteBufferOutputStream extends OutputStream { int newSize = (int)Math.min((((long)buf.capacity()) * 2), (long)(Integer.MAX_VALUE)); newSize = Math.max(newSize, buf.position() + extra); - - ByteBuffer newBuf = ByteBuffer.allocate(newSize); + ByteBuffer newBuf = null; + if (buf.isDirect()) { + newBuf = ByteBuffer.allocateDirect(newSize); + } else { + newBuf = ByteBuffer.allocate(newSize); + } buf.flip(); newBuf.put(buf); buf = newBuf;