@Override
  public void write(int b) {
    checkSizeAndGrow(Bytes.SIZEOF_BYTE);
    buf[this.pos] = (byte) b;
    this.pos++;
  }
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