Interface IDictionaryFactory

All Known Implementing Classes:
LingvoDSL, StarDict

public interface IDictionaryFactory
An interface that defines support for a particular dictionary format.
  • Method Details

    • isSupportedFile

      boolean isSupportedFile(File file)
      Determine whether or not the supplied file is supported by this factory. This is intended to be a lightweight check, e.g. looking for a file extension.
      Parameters:
      file - The file to check
      Returns:
      Whether or not the file is supported
    • loadDict

      IDictionary loadDict(File file) throws Exception
      Load the given file and return an IDictionary that wraps it. Deprecated; use loadDict(File, Language) instead.
      Parameters:
      file - The file to load
      Returns:
      An IDictionary file that can read articles from the file
      Throws:
      Exception - If the file could not be loaded for reasons that were not determined by isSupportedFile(File)
    • loadDict

      default IDictionary loadDict(File file, Language language) throws Exception
      Load the given file and return an IDictionary that wraps it. The supplied file is guaranteed to have returned true from isSupportedFile(File).
      Parameters:
      file - The file to load
      language - The language of the dictionary's index (e.g. English for an English-French dictionary)
      Returns:
      An IDictionary file that can read articles from the file
      Throws:
      Exception - If the file could not be loaded for reasons that were not determined by isSupportedFile(File)