public static void writeTags(OutputStream out, ExtendedCell cell, int tagsLength)
    throws IOException {
    if (cell instanceof ByteBufferExtendedCell) {
      ByteBufferUtils.copyBufferToStream(out, ((ByteBufferExtendedCell) cell).getTagsByteBuffer(),
        ((ByteBufferExtendedCell) cell).getTagsPosition(), tagsLength);
    } else {
      out.write(cell.getTagsArray(), cell.getTagsOffset(), tagsLength);
    }
  }
Writes the tag from the given cell to the output stream
@param out        The outputstream to which the data has to be written
@param cell       The cell whose contents has to be written
@param tagsLength the tag length
hbase-common/src/main/java/org/apache/hadoop/hbase/PrivateCellUtil.java