@Override
    public void write(ByteBuffer buf, int offset) {
      offset = KeyValueUtil.appendTo(this.cell, buf, offset, false);
      int tagsLen = this.tags == null ? 0 : this.tags.length;
      if (tagsLen > 0) {
        offset = ByteBufferUtils.putAsShort(buf, offset, tagsLen);
        ByteBufferUtils.copyFromArrayToBuffer(buf, offset, this.tags, 0, tagsLen);
      }
    }
@param cell The original ByteBufferExtendedCell which it rewrites
@param tags the tags bytes. The array suppose to contain the tags bytes alone.
hbase-common/src/main/java/org/apache/hadoop/hbase/PrivateCellUtil.java