public class BitTrieWriter extends Object implements TrieWriter
BitTrieWriter provides a trie writer that wraps a
bit-level output.
The reader for the output of a bit trie writer is BitTrieReader.
Counts of trie nodes and differences between
successive symbols on transitions are delta coded for compression
(see BitOutput.writeDelta(long)).
The method copy(TrieReader,TrieWriter) is available to
copy the contents of a reader to a writer.
| Constructor and Description |
|---|
BitTrieWriter(BitOutput bitOutput)
Construct a bit trie writer from the specified bit output
with the specified maximum n-gram.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
copy(TrieReader reader,
TrieWriter writer)
Copies the content of the specified trie reader to the specified
trie writer.
|
void |
writeCount(long count)
Writes the specified count for the next sub-trie.
|
void |
writeSymbol(long symbol)
Writes the specified symbol for the next daughter.
|
public BitTrieWriter(BitOutput bitOutput)
bitOutput - Underlying bit output.public void writeCount(long count)
throws IOException
TrieWriterwriteCount in interface TrieWritercount - Count to write.IOException - If there is an underlying I/O error.public void writeSymbol(long symbol)
throws IOException
TrieWriterThe symbol -1 must be written following the last
daughter of a tree.
writeSymbol in interface TrieWritersymbol - Symbol to write.IOException - If there is an underlying I/O error.public static void copy(TrieReader reader, TrieWriter writer) throws IOException
reader - Reader from which to read.writer - Writer to which to write.IOExceptionCopyright © 2016 Alias-i, Inc.. All rights reserved.