@Override
    public int write(OutputStream out, boolean withTags) throws IOException {
      int len = ((ExtendedCell) this.cell).write(out, false);
      if (withTags && this.tags != null) {
        // Write the tagsLength 2 bytes
        out.write((byte) (0xff & (this.tags.length >> 8)));
        out.write((byte) (0xff & this.tags.length));
        out.write(this.tags);
        len += KeyValue.TAGS_LENGTH_SIZE + this.tags.length;
      }
      return len;
    }
@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