@Override
  public void write(ByteBuffer b, int off, int len) {
    checkSizeAndGrow(len);
    ByteBufferUtils.copyFromBufferToArray(this.buf, b, off, this.pos, len);
    this.pos += len;
  }
Our own implementation of ByteArrayOutputStream where all methods are NOT synchronized and
supports writing ByteBuffer directly to it.
hbase-common/src/main/java/org/apache/hadoop/hbase/io/ByteArrayOutputStream.java