public void serialize(final PublicBAOS outputStream) throws IOException {
    ReadWriteIOUtils.write(name, outputStream);
    if (valueSet == null) {
      ReadWriteIOUtils.write(mark ? -1 : -2, outputStream);
    } else {
      ReadWriteIOUtils.write(valueSet.size(), outputStream);
      for (final V value : valueSet) {
        serializer.write(value, outputStream);
      }
    }
    ReadWriteIOUtils.write(children.size(), outputStream);
    serializeChildren(outputStream);
  }
Serialize PathPatternNode

<ul>
  <li>[required] 1 string: name. It specifies the name of node
  <li>[required] 1 int: nodeType or size of valueSet.
      <ul>
        <li>If this node is being used by PathPatternTree, it specifies the type of this node.
            -1 means from root to the current node is a registered path pattern. Otherwise -2.
        <li>If this node is being used by PatternTreeMap, it specifies the size of valueSet
            which will be serialized next.(>=0)
      </ul>
  <li>[optional] valueSet
  <li>[required] 1 int: children size.
  <li>[optional] children
</ul>
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/path/PathPatternNode.java