Package morfologik.fsa.builders
Interface FSASerializer
-
- All Known Implementing Classes:
CFSA2Serializer
,FSA5Serializer
public interface FSASerializer
All FSA serializers (to binary formats) will implement this interface.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.Set<FSAFlags>
getFlags()
<T extends java.io.OutputStream>
Tserialize(FSA fsa, T os)
Serialize a finite state automaton to an output stream.FSASerializer
withAnnotationSeparator(byte annotationSeparator)
Sets the annotation separator (only ifgetFlags()
returnsFSAFlags.SEPARATORS
).FSASerializer
withFiller(byte filler)
Sets the filler separator (only ifgetFlags()
returnsFSAFlags.SEPARATORS
).FSASerializer
withNumbers()
Enables support for right language count on nodes, speeding up perfect hash counts (only ifgetFlags()
returnsFSAFlags.NUMBERS
).
-
-
-
Method Detail
-
serialize
<T extends java.io.OutputStream> T serialize(FSA fsa, T os) throws java.io.IOException
Serialize a finite state automaton to an output stream.- Type Parameters:
T
- A subclass ofOutputStream
, returned for chaining.- Parameters:
fsa
- The automaton to serialize.os
- The output stream to serialize to.- Returns:
- Returns
T
for chaining. - Throws:
java.io.IOException
- Rethrown if an I/O error occurs.
-
getFlags
java.util.Set<FSAFlags> getFlags()
- Returns:
- Returns the set of flags supported by the serializer (and the output automaton).
-
withFiller
FSASerializer withFiller(byte filler)
Sets the filler separator (only ifgetFlags()
returnsFSAFlags.SEPARATORS
).- Parameters:
filler
- The filler separator byte.- Returns:
- Returns
this
for call chaining.
-
withAnnotationSeparator
FSASerializer withAnnotationSeparator(byte annotationSeparator)
Sets the annotation separator (only ifgetFlags()
returnsFSAFlags.SEPARATORS
).- Parameters:
annotationSeparator
- The filler separator byte.- Returns:
- Returns
this
for call chaining.
-
withNumbers
FSASerializer withNumbers()
Enables support for right language count on nodes, speeding up perfect hash counts (only ifgetFlags()
returnsFSAFlags.NUMBERS
).- Returns:
- Returns
this
for call chaining.
-
-