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 class
Lucene50CompoundReader.FileEntry
Offset/Length for a slice inside of a compound file
-
Field Summary
Fields Modifier and Type Field Description private Directory
directory
private java.util.Map<java.lang.String,Lucene50CompoundReader.FileEntry>
entries
private IndexInput
handle
private java.lang.String
segmentName
private int
version
-
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 void
checkIntegrity()
Checks consistency of this directory.void
close()
Closes the directory.long
fileLength(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.IndexInput
openInput(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.String
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 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.IOException
Description copied from class:Directory
Closes the directory.
-
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 eitherNoSuchFileException
orFileNotFoundException
ifname
points 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.IOException
Returns the length of a file in the directory.- Specified by:
fileLength
in 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:Directory
Returns a set of files currently pending deletion in this directory.- Specified by:
getPendingDeletions
in classDirectory
-
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 classCompoundDirectory
- Throws:
java.io.IOException
-
-