Class Lucene50CompoundReader

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    final class Lucene50CompoundReader
    extends CompoundDirectory
    Class for accessing a compound stream. This class implements a directory, but is limited to only read operations. Directory methods that would normally modify data throw an exception.
    • Constructor Detail

      • Lucene50CompoundReader

        public Lucene50CompoundReader​(Directory directory,
                                      SegmentInfo si,
                                      IOContext context)
                               throws java.io.IOException
        Create a new CompoundFileDirectory.
        Throws:
        java.io.IOException
    • Method Detail

      • readEntries

        private java.util.Map<java.lang.String,​Lucene50CompoundReader.FileEntry> readEntries​(byte[] segmentID,
                                                                                                   Directory dir,
                                                                                                   java.lang.String entriesFileName)
                                                                                            throws java.io.IOException
        Helper method that reads CFS entries from an input stream
        Throws:
        java.io.IOException
      • close

        public void close()
                   throws java.io.IOException
        Description copied from class: Directory
        Closes the directory.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in class Directory
        Throws:
        java.io.IOException
      • openInput

        public IndexInput openInput​(java.lang.String name,
                                    IOContext context)
                             throws java.io.IOException
        Description copied from class: Directory
        Opens a stream for reading an existing file.

        This method must throw either NoSuchFileException or FileNotFoundException if name points to a non-existing file.

        Specified by:
        openInput in class Directory
        Parameters:
        name - the name of an existing file.
        Throws:
        java.io.IOException - in case of I/O error
      • listAll

        public java.lang.String[] listAll()
        Returns an array of strings, one for each file in the directory.
        Specified by:
        listAll in class Directory
      • fileLength

        public long fileLength​(java.lang.String name)
                        throws java.io.IOException
        Returns the length of a file in the directory.
        Specified by:
        fileLength in class Directory
        Parameters:
        name - the name of an existing file.
        Throws:
        java.io.IOException - if the file does not exist
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class Directory
      • getPendingDeletions

        public java.util.Set<java.lang.String> getPendingDeletions()
        Description copied from class: Directory
        Returns a set of files currently pending deletion in this directory.
        Specified by:
        getPendingDeletions in class Directory
      • checkIntegrity

        public void checkIntegrity()
                            throws java.io.IOException
        Description copied from class: CompoundDirectory
        Checks consistency of this directory.

        Note that this may be costly in terms of I/O, e.g. may involve computing a checksum value against large data files.

        Specified by:
        checkIntegrity in class CompoundDirectory
        Throws:
        java.io.IOException