Package org.egothor.stemmer
Class StemmerPatchTrieBinaryIO
java.lang.Object
org.egothor.stemmer.StemmerPatchTrieBinaryIO
Binary persistence helper for patch-command stemmer tries.
This class persists FrequencyTrie instances whose values are compact
patch commands represented as String. The serialized trie payload is
the native binary format of FrequencyTrie, wrapped in GZip
compression.
The helper centralizes the codec and compression details so that higher-level loader APIs can remain focused on source selection rather than stream mechanics.
-
Method Summary
Modifier and TypeMethodDescriptionstatic FrequencyTrie<String> read(InputStream inputStream) Reads a GZip-compressed binary patch-command trie from an input stream.static FrequencyTrie<String> Reads a GZip-compressed binary patch-command trie from a filesystem path string.static FrequencyTrie<String> Reads a GZip-compressed binary patch-command trie from a filesystem path.static voidwrite(FrequencyTrie<String> trie, OutputStream outputStream) Writes a GZip-compressed binary patch-command trie to an output stream.static voidwrite(FrequencyTrie<String> trie, String fileName) Writes a GZip-compressed binary patch-command trie to a filesystem path string.static voidwrite(FrequencyTrie<String> trie, Path path) Writes a GZip-compressed binary patch-command trie to a filesystem path.
-
Method Details
-
read
Reads a GZip-compressed binary patch-command trie from a filesystem path.- Parameters:
path- source file- Returns:
- deserialized trie
- Throws:
NullPointerException- ifpathisnullIOException- if reading or decompression fails
-
read
Reads a GZip-compressed binary patch-command trie from a filesystem path string.- Parameters:
fileName- source file name or path string- Returns:
- deserialized trie
- Throws:
NullPointerException- iffileNameisnullIOException- if reading or decompression fails
-
read
Reads a GZip-compressed binary patch-command trie from an input stream.The supplied stream is consumed but not interpreted as plain trie bytes; it is first decompressed using
GZIPInputStream.- Parameters:
inputStream- source stream- Returns:
- deserialized trie
- Throws:
NullPointerException- ifinputStreamisnullIOException- if reading or decompression fails
-
write
Writes a GZip-compressed binary patch-command trie to a filesystem path.- Parameters:
trie- trie to persistpath- target file- Throws:
NullPointerException- if any argument isnullIOException- if writing fails
-
write
Writes a GZip-compressed binary patch-command trie to a filesystem path string.- Parameters:
trie- trie to persistfileName- target file name or path string- Throws:
NullPointerException- if any argument isnullIOException- if writing fails
-
write
Writes a GZip-compressed binary patch-command trie to an output stream.- Parameters:
trie- trie to persistoutputStream- target stream- Throws:
NullPointerException- if any argument isnullIOException- if writing fails
-