Package opennlp.tools.dictionary.serializer

# Class DictionaryEntryPersistor

java.lang.Object
opennlp.tools.dictionary.serializer.DictionaryEntryPersistor

public class DictionaryEntryPersistor extends Object
A persistor used by for reading and writing `dictionaries` of all kinds.

See Also:
  - `Dictionary`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DictionaryEntryPersistor()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static boolean`
  `create(InputStream in, EntryInserter inserter)`
  Creates `Entry`s from the given `InputStream` and forwards these `Entry`s to the `EntryInserter`.
  `static void`
  `serialize(OutputStream out, Iterator<Entry> entries, boolean casesensitive)`
  Serializes the given entries to the given `OutputStream`.

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### DictionaryEntryPersistor

    public DictionaryEntryPersistor()

- ## Method Details

  - ### create

    public static boolean create(InputStream in, EntryInserter inserter) throws IOException
    Creates `Entry`s from the given `InputStream` and forwards these `Entry`s to the `EntryInserter`.

    Note: After creation is finished the provided `InputStream` is closed.

    Parameters:
      `in` - The open `InputStream` to read entries from.
      `inserter` - inserter to forward entries to
    Returns:
      The `isCaseSensitive` attribute of a `Dictionary`.
    Throws:
      `IOException` - Thrown if IO errors occurred.
      `InvalidFormatException` - Thrown if parameters were invalid.

  - ### serialize

    public static void serialize(OutputStream out, Iterator<Entry> entries, boolean casesensitive) throws IOException
    Serializes the given entries to the given `OutputStream`.

    Note: After the serialization is finished the provided `OutputStream` remains open.

    Parameters:
      `out` - The `OutputStream` to serialize to.
      `entries` - The `entries` to serialize.
      `casesensitive` - Indicates if the written dictionary should be case-sensitive, or not.
    Throws:
      `IOException` - Thrown if IO errors occurred.
      `InvalidFormatException` - Thrown if parameters were invalid.