Class PlainTextDictionary

  • All Implemented Interfaces:
    Dictionary

    public class PlainTextDictionary
    extends java.lang.Object
    implements Dictionary
    Dictionary represented by a text file.

    Format allowed: 1 word per line:
    word1
    word2
    word3

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.io.BufferedReader in  
    • Constructor Summary

      Constructors 
      Constructor Description
      PlainTextDictionary​(java.io.InputStream dictFile)
      Creates a dictionary based on an inputstream.
      PlainTextDictionary​(java.io.Reader reader)
      Creates a dictionary based on a reader.
      PlainTextDictionary​(java.nio.file.Path path)
      Creates a dictionary based on a Path.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      InputIterator getEntryIterator()
      Returns an iterator over all the entries
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • in

        private java.io.BufferedReader in
    • Constructor Detail

      • PlainTextDictionary

        public PlainTextDictionary​(java.nio.file.Path path)
                            throws java.io.IOException
        Creates a dictionary based on a Path.

        NOTE: content is treated as UTF-8

        Throws:
        java.io.IOException
      • PlainTextDictionary

        public PlainTextDictionary​(java.io.InputStream dictFile)
        Creates a dictionary based on an inputstream.

        NOTE: content is treated as UTF-8

      • PlainTextDictionary

        public PlainTextDictionary​(java.io.Reader reader)
        Creates a dictionary based on a reader.
    • Method Detail

      • getEntryIterator

        public InputIterator getEntryIterator()
                                       throws java.io.IOException
        Description copied from interface: Dictionary
        Returns an iterator over all the entries
        Specified by:
        getEntryIterator in interface Dictionary
        Returns:
        Iterator
        Throws:
        java.io.IOException