code: public byte[] toByteArray() throws IOException {
      // TODO: in the future actual serialization here should be done using protobufs
      ByteArrayOutputStream bos = new ByteArrayOutputStream();
      write(new DataOutputStream(bos));
      return bos.toByteArray();
    }
docs: /* Serialization support for HBase 0.96+