public void writeTo(OutputStream out) throws IOException {
    WritableByteChannel channel = Channels.newChannel(out);
    ByteBuffer bb = curBuf.duplicate();
    bb.flip();
    channel.write(bb);
  }
Writes the complete contents of this byte buffer output stream to the specified output stream
argument.
@param out the output stream to which to write the data.
@exception IOException if an I/O error occurs.
hbase-common/src/main/java/org/apache/hadoop/hbase/io/ByteBufferOutputStream.java