Interface FileManager

  • All Superinterfaces:
    Createable, java.rmi.Remote
    All Known Implementing Classes:
    FileManagerImpl, RemoteFileManager

    public interface FileManager
    extends java.rmi.Remote, Createable
    FileManager defines the interface between the FileBackedDictionary and the file system. Methods in this interface operate on and return offsets, which are indices into a dictionary file.
    • Method Detail

      • getIndexedLinePointer

        long getIndexedLinePointer​(POS pos,
                                   DictionaryFileType fileType,
                                   java.lang.String index)
                            throws java.io.IOException,
                                   java.rmi.RemoteException
        Search for the line whose first word is index (that is, that begins with index followed by a space or tab).
        Returns:
        The file offset of the start of the matching line, or -1 if no such line exists.
        Throws:
        java.io.IOException
        java.rmi.RemoteException
      • readLineAt

        java.lang.String readLineAt​(POS pos,
                                    DictionaryFileType fileType,
                                    long offset)
                             throws java.io.IOException,
                                    java.rmi.RemoteException
        Read the line that begins at file offset offset.
        Throws:
        java.io.IOException
        java.rmi.RemoteException
      • getNextLinePointer

        long getNextLinePointer​(POS pos,
                                DictionaryFileType fileType,
                                long offset)
                         throws java.io.IOException,
                                java.rmi.RemoteException
        Search for the line following the line that begins at offset.
        Returns:
        The file offset of the start of the line, or -1 if offset is the last line in the file.
        Throws:
        java.io.IOException
        java.rmi.RemoteException
      • getMatchingLinePointer

        long getMatchingLinePointer​(POS pos,
                                    DictionaryFileType fileType,
                                    long offset,
                                    java.lang.String substring)
                             throws java.io.IOException,
                                    java.rmi.RemoteException
        Search for a line whose index word contains substring, starting at offset.
        Returns:
        The file offset of the start of the matchng line, or -1 if no such line exists.
        Throws:
        java.io.IOException
        java.rmi.RemoteException
      • getRandomLinePointer

        long getRandomLinePointer​(POS pos,
                                  DictionaryFileType index)
                           throws java.io.IOException
        Return a randomly-chosen line pointer (offset of the beginning of a line).
        Parameters:
        pos -
        index -
        Returns:
        Throws:
        java.io.IOException
      • getFirstLinePointer

        long getFirstLinePointer​(POS pos,
                                 DictionaryFileType fileType)
                          throws java.io.IOException
        Return the first valid line pointer in the specified file.
        Parameters:
        pos -
        fileType -
        Returns:
        Throws:
        java.io.IOException
      • close

        void close()
        Shut down the file manager.