@Override
  public void writeInt(int i) {
    checkSizeAndGrow(Bytes.SIZEOF_INT);
    Bytes.putInt(this.buf, this.pos, i);
    this.pos += Bytes.SIZEOF_INT;
  }
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