public interface TrieWriter
TrieWriterinterface provides a means to write an arbitrary trie structure with positive node counts.
A trie is encoded depth-first according to the following
recursive definition. First, the the count of the tree
count) is encoded. Then, for each daughter
1 <= K <= N, in
increasing symbol order, the daughter symbol (
is encoded followed by the encoding of the daughter tree
dtrTreeK). Finally, after the last daughter tree is
encoded, the number
-1 is encoded.
encode(tree) = count dtrSym1 encode(dtrTree1) ... dtrSymN encode(dtrTreeN) -1
This results in a unique depth-first encoding of an entire tree
as a sequence of
void writeCount(long count) throws IOException
void writeSymbol(long symbol) throws IOException
-1 must be written following the last
daughter of a tree.