public int size() {
    return size;
  }
Similar to the ByteArrayOutputStream, with the exception that we can prepend an header. e.g. you
write some data and you want to prepend an header that contains the data len or cksum. <code>
ByteSlot slot = new ByteSlot();
// write data
slot.write(...);
slot.write(...);
// write header with the size of the written data
slot.markHead();
slot.write(Bytes.toBytes(slot.size()));
// flush to stream as [header, data]
slot.writeTo(stream);
</code>
hbase-procedure/src/main/java/org/apache/hadoop/hbase/procedure2/util/ByteSlot.java