Class Lucene50CompoundReader

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

    final class Lucene50CompoundReader
    extends Directory
    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
      • deleteFile

        public void deleteFile​(java.lang.String name)
        Not implemented
        Specified by:
        deleteFile in class Directory
        Parameters:
        name - the name of an existing file.
        Throws:
        java.lang.UnsupportedOperationException - always: not supported by CFS
      • rename

        public void rename​(java.lang.String from,
                           java.lang.String to)
        Not implemented
        Specified by:
        rename in class Directory
        Throws:
        java.lang.UnsupportedOperationException - always: not supported by CFS
      • 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
      • createOutput

        public IndexOutput createOutput​(java.lang.String name,
                                        IOContext context)
                                 throws java.io.IOException
        Description copied from class: Directory
        Creates a new, empty file in the directory and returns an IndexOutput instance for appending data to this file. This method must throw FileAlreadyExistsException if the file already exists.
        Specified by:
        createOutput in class Directory
        Parameters:
        name - the name of the file to create.
        Throws:
        java.io.IOException - in case of I/O error
      • createTempOutput

        public IndexOutput createTempOutput​(java.lang.String prefix,
                                            java.lang.String suffix,
                                            IOContext context)
                                     throws java.io.IOException
        Description copied from class: Directory
        Creates a new, empty, temporary file in the directory and returns an IndexOutput instance for appending data to this file. The temporary file name (accessible via IndexOutput.getName()) will start with prefix, end with suffix and have a reserved file extension .tmp.
        Specified by:
        createTempOutput in class Directory
        Throws:
        java.io.IOException
      • sync

        public void sync​(java.util.Collection<java.lang.String> names)
        Description copied from class: Directory
        Ensures that any writes to these files are moved to stable storage (made durable). Lucene uses this to properly commit changes to the index, to prevent a machine/OS crash from corrupting the index.
        Specified by:
        sync in class Directory
        See Also:
        Directory.syncMetaData()
      • obtainLock

        public Lock obtainLock​(java.lang.String name)
        Description copied from class: Directory
        Acquires and returns a Lock for a file with the given name.
        Specified by:
        obtainLock in class Directory
        Parameters:
        name - the name of the lock file
      • 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