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.filler
public byte annotationByte
FSA5.annotation
public FSA5Serializer withNumbers()
withNumbers
in interface FSASerializer
public FSA5Serializer withFiller(byte filler)
FSASerializer.getFlags()
returns
FSAFlags.SEPARATORS
).withFiller
in interface FSASerializer
filler
- The filler separator byte.this
for call chaining.public FSA5Serializer withAnnotationSeparator(byte annotationSeparator)
FSASerializer.getFlags()
returns
FSAFlags.SEPARATORS
).withAnnotationSeparator
in interface FSASerializer
annotationSeparator
- 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 FSASerializer
T
- 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 FSASerializer
Copyright © 2016. All rights reserved.