Class Lucene50CompoundReader
- java.lang.Object
-
- org.apache.lucene.store.Directory
-
- org.apache.lucene.codecs.CompoundDirectory
-
- org.apache.lucene.codecs.lucene50.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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLucene50CompoundReader.FileEntryOffset/Length for a slice inside of a compound file
-
Field Summary
Fields Modifier and Type Field Description private Directorydirectoryprivate java.util.Map<java.lang.String,Lucene50CompoundReader.FileEntry>entriesprivate IndexInputhandleprivate java.lang.StringsegmentNameprivate intversion
-
Constructor Summary
Constructors Constructor Description Lucene50CompoundReader(Directory directory, SegmentInfo si, IOContext context)Create a new CompoundFileDirectory.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcheckIntegrity()Checks consistency of this directory.voidclose()Closes the directory.longfileLength(java.lang.String name)Returns the length of a file in the directory.java.util.Set<java.lang.String>getPendingDeletions()Returns a set of files currently pending deletion in this directory.java.lang.String[]listAll()Returns an array of strings, one for each file in the directory.IndexInputopenInput(java.lang.String name, IOContext context)Opens a stream for reading an existing file.private java.util.Map<java.lang.String,Lucene50CompoundReader.FileEntry>readEntries(byte[] segmentID, Directory dir, java.lang.String entriesFileName)Helper method that reads CFS entries from an input streamjava.lang.StringtoString()-
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 Detail
-
directory
private final Directory directory
-
segmentName
private final java.lang.String segmentName
-
entries
private final java.util.Map<java.lang.String,Lucene50CompoundReader.FileEntry> entries
-
handle
private final IndexInput handle
-
version
private int version
-
-
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.IOExceptionDescription copied from class:DirectoryCloses the directory.
-
openInput
public IndexInput openInput(java.lang.String name, IOContext context) throws java.io.IOException
Description copied from class:DirectoryOpens a stream for reading an existing file. This method must throw eitherNoSuchFileExceptionorFileNotFoundExceptionifnamepoints to a non-existing file.
-
listAll
public java.lang.String[] listAll()
Returns an array of strings, one for each file in the directory.
-
fileLength
public long fileLength(java.lang.String name) throws java.io.IOExceptionReturns the length of a file in the directory.- Specified by:
fileLengthin classDirectory- Parameters:
name- the name of an existing file.- Throws:
java.io.IOException- if the file does not exist
-
getPendingDeletions
public java.util.Set<java.lang.String> getPendingDeletions()
Description copied from class:DirectoryReturns a set of files currently pending deletion in this directory.- Specified by:
getPendingDeletionsin classDirectory
-
checkIntegrity
public void checkIntegrity() throws java.io.IOExceptionDescription 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:
java.io.IOException
-
-