public final class FSA5Serializer extends Object implements FSASerializer
FSA graphs to a binary format compatible with
Jan Daciuk's fsa's package FSA5 format.
It is possible to serialize the automaton with numbers required for perfect
hashing. See withNumbers() method.
FSA5,
FSA.read(java.io.InputStream)| Modifier and Type | Field and Description |
|---|---|
byte |
annotationByte |
byte |
fillerByte |
| Constructor and Description |
|---|
FSA5Serializer() |
| Modifier and Type | Method and Description |
|---|---|
Set<FSAFlags> |
getFlags()
Return supported flags.
|
<T extends OutputStream> |
serialize(FSA fsa,
T os)
Serialize root state
s to an output stream in
FSA5 format. |
FSA5Serializer |
withAnnotationSeparator(byte annotationSeparator)
Sets the annotation separator (only if
FSASerializer.getFlags() returns
FSAFlags.SEPARATORS). |
FSA5Serializer |
withFiller(byte filler)
Sets the filler separator (only if
FSASerializer.getFlags() returns
FSAFlags.SEPARATORS). |
FSA5Serializer |
withNumbers()
Serialize the automaton with the number of right-language sequences in each
node.
|
public byte fillerByte
FSA5.fillerpublic byte annotationByte
FSA5.annotationpublic FSA5Serializer withNumbers()
withNumbers in interface FSASerializerpublic FSA5Serializer withFiller(byte filler)
FSASerializer.getFlags() returns
FSAFlags.SEPARATORS).withFiller in interface FSASerializerfiller - The filler separator byte.this for call chaining.public FSA5Serializer withAnnotationSeparator(byte annotationSeparator)
FSASerializer.getFlags() returns
FSAFlags.SEPARATORS).withAnnotationSeparator in interface FSASerializerannotationSeparator - The filler separator byte.this for call chaining.public <T extends OutputStream> T serialize(FSA fsa, T os) throws IOException
s to an output stream in
FSA5 format.serialize in interface FSASerializerT - A subclass of OutputStream, returned for chaining.fsa - The automaton to serialize.os - The output stream to serialize to.os for chaining.IOException - Rethrown if an I/O error occurs.withNumbers()public Set<FSAFlags> getFlags()
getFlags in interface FSASerializerCopyright © 2016. All rights reserved.