Class Lucene50CompoundReader
java.lang.Object
org.apache.lucene.store.Directory
org.apache.lucene.codecs.CompoundDirectory
org.apache.lucene.backward_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 class
Offset/Length for a slice inside of a compound file -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Directory
private final Map<String,
Lucene50CompoundReader.FileEntry> private final IndexInput
private final String
private int
-
Constructor Summary
ConstructorsConstructorDescriptionLucene50CompoundReader
(Directory directory, SegmentInfo si, IOContext context) Create a new CompoundFileDirectory. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Checks consistency of this directory.void
close()
Closes the directory.long
fileLength
(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 streamprivate Map<String,
Lucene50CompoundReader.FileEntry> readMapping
(IndexInput entriesStream) toString()
Methods inherited from class org.apache.lucene.codecs.CompoundDirectory
createOutput, createTempOutput, deleteFile, obtainLock, rename, sync, syncMetaData
Methods 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
-
readMapping
private Map<String,Lucene50CompoundReader.FileEntry> readMapping(IndexInput entriesStream) throws IOException - Throws:
IOException
-
close
Description copied from class:Directory
Closes the directory.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in classDirectory
- Throws:
IOException
-
openInput
Description copied from class:Directory
Opens a stream for reading an existing file.This method must throw either
NoSuchFileException
orFileNotFoundException
ifname
points to a non-existing file.- Specified by:
openInput
in 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:
fileLength
in classDirectory
- Parameters:
name
- the name of an existing file.- Throws:
IOException
- if the file does not exist
-
toString
-
getPendingDeletions
Description copied from class:Directory
Returns a set of files currently pending deletion in this directory.- Specified by:
getPendingDeletions
in classDirectory
-
checkIntegrity
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 classCompoundDirectory
- Throws:
IOException
-