Class Lucene50CompoundReader
java.lang.Object
org.apache.lucene.store.Directory
org.apache.lucene.codecs.CompoundDirectory
org.apache.lucene.codecs.lucene50.Lucene50CompoundReader
- All Implemented Interfaces:
Closeable,AutoCloseable
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classOffset/Length for a slice inside of a compound file -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Directoryprivate final Map<String, Lucene50CompoundReader.FileEntry> private final IndexInputprivate final Stringprivate int -
Constructor Summary
ConstructorsConstructorDescriptionLucene50CompoundReader(Directory directory, SegmentInfo si, IOContext context) Create a new CompoundFileDirectory. -
Method Summary
Modifier and TypeMethodDescriptionvoidChecks consistency of this directory.voidclose()Closes the directory.longfileLength(String name) Returns the length of a file in the directory.Returns a set of files currently pending deletion in this directory.String[]listAll()Returns an array of strings, one for each file in the directory.Opens a stream for reading an existing file.private Map<String, Lucene50CompoundReader.FileEntry> readEntries(byte[] segmentID, Directory dir, String entriesFileName) Helper method that reads CFS entries from an input streamtoString()Methods inherited from class org.apache.lucene.codecs.CompoundDirectory
createOutput, createTempOutput, deleteFile, obtainLock, rename, sync, syncMetaDataMethods inherited from class org.apache.lucene.store.Directory
copyFrom, ensureOpen, getTempFileName, openChecksumInput
-
Field Details
-
directory
-
segmentName
-
entries
-
handle
-
version
private int version
-
-
Constructor Details
-
Lucene50CompoundReader
public Lucene50CompoundReader(Directory directory, SegmentInfo si, IOContext context) throws IOException Create a new CompoundFileDirectory.- Throws:
IOException
-
-
Method Details
-
readEntries
private Map<String,Lucene50CompoundReader.FileEntry> readEntries(byte[] segmentID, Directory dir, String entriesFileName) throws IOException Helper method that reads CFS entries from an input stream- Throws:
IOException
-
close
Description copied from class:DirectoryCloses the directory.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classDirectory- Throws:
IOException
-
openInput
Description copied from class:DirectoryOpens a stream for reading an existing file. This method must throw eitherNoSuchFileExceptionorFileNotFoundExceptionifnamepoints to a non-existing file.- Specified by:
openInputin classDirectory- Parameters:
name- the name of an existing file.- Throws:
IOException- in case of I/O error
-
listAll
Returns an array of strings, one for each file in the directory. -
fileLength
Returns the length of a file in the directory.- Specified by:
fileLengthin classDirectory- Parameters:
name- the name of an existing file.- Throws:
IOException- if the file does not exist
-
toString
-
getPendingDeletions
Description copied from class:DirectoryReturns a set of files currently pending deletion in this directory.- Specified by:
getPendingDeletionsin classDirectory
-
checkIntegrity
Description copied from class:CompoundDirectoryChecks 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:
checkIntegrityin classCompoundDirectory- Throws:
IOException
-