code: public int serialize(OutputStream os) throws IOException {
          DataOutputStream dos = new DataOutputStream(os);
          int  bytesWritten = 0;
          
          bytesWritten += serializeHeader(dos);        
          for (int i=0; i<dataLength; i++) {
              dos.writeChar(index[data16+i]);
          }
          bytesWritten += dataLength*2;        
          return bytesWritten;
      }
docs: Serialize a Trie2_16 onto an OutputStream.
  
  A Trie2 can be serialized multiple times.
  The serialized data is compatible with ICU4C UTrie2 serialization.
  Trie2 serialization is unrelated to Java object serialization.
  
  @param os the stream to which the serialized Trie2 data will be written.
  @return the number of bytes written.
  @throw IOException on an error writing to the OutputStream.