Interface IDictionaryFactory

  • All Known Implementing Classes:
    LingvoDSL, StarDict

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

      • isSupportedFile

        boolean isSupportedFile​(java.io.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​(java.io.File file)
                      throws java.lang.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:
        java.lang.Exception - If the file could not be loaded for reasons that were not determined by isSupportedFile(File)
      • loadDict

        default IDictionary loadDict​(java.io.File file,
                                     Language language)
                              throws java.lang.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:
        java.lang.Exception - If the file could not be loaded for reasons that were not determined by isSupportedFile(File)