public final void writeToStream(DataOutputStream dos) throws IOException {
  dos.writeUTF(event);
  dos.writeUTF(site);
  dos.writeUTF(date);
  dos.writeUTF(round);
  dos.writeUTF(white);
  dos.writeUTF(black);
  dos.writeUTF(TextIO.toFEN(startPos));
  dos.writeUTF(timeControl);
  dos.writeUTF(whiteTimeControl);
  dos.writeUTF(blackTimeControl);
  int nTags=tagPairs.size();
  dos.writeInt(nTags);
  for (int i=0; i < nTags; i++) {
    dos.writeUTF(tagPairs.get(i).tagName);
    dos.writeUTF(tagPairs.get(i).tagValue);
  }
  Node.writeToStream(dos,rootNode);
  ArrayList<Integer> pathFromRoot=currentNode.getPathFromRoot();
  int pathLen=pathFromRoot.size();
  dos.writeInt(pathLen);
  for (int i=0; i < pathLen; i++)   dos.writeInt(pathFromRoot.get(i));
}

public final void writeToStream ( DataOutputStream dos ) throws IOException { dos . writeUTF ( event ) ; dos . writeUTF ( site ) ; dos . writeUTF ( date ) ; dos . writeUTF ( round ) ; dos . writeUTF ( white ) ; dos . writeUTF ( black ) ; dos . writeUTF ( TextIO . toFEN ( startPos ) ) ; dos . writeUTF ( timeControl ) ; dos . writeUTF ( whiteTimeControl ) ; dos . writeUTF ( blackTimeControl ) ; int nTags = tagPairs . size ( ) ; dos . writeInt ( nTags ) ; for ( int i = 0 ; i < nTags ; i ++ ) { dos . writeUTF ( tagPairs . get ( i ) . tagName ) ; dos . writeUTF ( tagPairs . get ( i ) . tagValue ) ; } Node . writeToStream ( dos , rootNode ) ; ArrayList < Integer > pathFromRoot = currentNode . getPathFromRoot ( ) ; int pathLen = pathFromRoot . size ( ) ; dos . writeInt ( pathLen ) ; for ( int i = 0 ; i < pathLen ; i ++ ) dos . writeInt ( pathFromRoot . get ( i ) ) ; }
serialize to output stream .
