final class Lucene50CompoundReader extends Directory
Modifier and Type | Class and Description |
---|---|
static class |
Lucene50CompoundReader.FileEntry
Offset/Length for a slice inside of a compound file
|
Modifier and Type | Field and 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 and Description |
---|
Lucene50CompoundReader(Directory directory,
SegmentInfo si,
IOContext context)
Create a new CompoundFileDirectory.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the directory.
|
IndexOutput |
createOutput(java.lang.String name,
IOContext context)
Creates a new, empty file in the directory and returns an
IndexOutput
instance for appending data to this file. |
IndexOutput |
createTempOutput(java.lang.String prefix,
java.lang.String suffix,
IOContext context)
Creates a new, empty, temporary file in the directory and returns an
IndexOutput
instance for appending data to this file. |
void |
deleteFile(java.lang.String name)
Not implemented
|
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.
|
Lock |
obtainLock(java.lang.String name)
Acquires and returns a
Lock for a file with the given name. |
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 stream
|
void |
rename(java.lang.String from,
java.lang.String to)
Not implemented
|
void |
sync(java.util.Collection<java.lang.String> names)
Ensures that any writes to these files are moved to
stable storage (made durable).
|
void |
syncMetaData()
Ensures that directory metadata, such as recent file renames, are moved to stable
storage.
|
java.lang.String |
toString() |
copyFrom, ensureOpen, openChecksumInput
private final Directory directory
private final java.lang.String segmentName
private final java.util.Map<java.lang.String,Lucene50CompoundReader.FileEntry> entries
private final IndexInput handle
private int version
public Lucene50CompoundReader(Directory directory, SegmentInfo si, IOContext context) throws java.io.IOException
java.io.IOException
private java.util.Map<java.lang.String,Lucene50CompoundReader.FileEntry> readEntries(byte[] segmentID, Directory dir, java.lang.String entriesFileName) throws java.io.IOException
java.io.IOException
public void close() throws java.io.IOException
Directory
public IndexInput openInput(java.lang.String name, IOContext context) throws java.io.IOException
Directory
NoSuchFileException
or FileNotFoundException
if name
points to a non-existing file.public java.lang.String[] listAll()
public void deleteFile(java.lang.String name)
deleteFile
in class Directory
name
- the name of an existing file.java.lang.UnsupportedOperationException
- always: not supported by CFSpublic void rename(java.lang.String from, java.lang.String to)
public void syncMetaData()
Directory
syncMetaData
in class Directory
Directory.sync(Collection)
public long fileLength(java.lang.String name) throws java.io.IOException
fileLength
in class Directory
name
- the name of an existing file.java.io.IOException
- if the file does not existpublic IndexOutput createOutput(java.lang.String name, IOContext context) throws java.io.IOException
Directory
IndexOutput
instance for appending data to this file.
This method must throw FileAlreadyExistsException
if the file
already exists.createOutput
in class Directory
name
- the name of the file to create.java.io.IOException
- in case of I/O errorpublic IndexOutput createTempOutput(java.lang.String prefix, java.lang.String suffix, IOContext context) throws java.io.IOException
Directory
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
.createTempOutput
in class Directory
java.io.IOException
public void sync(java.util.Collection<java.lang.String> names)
Directory
sync
in class Directory
Directory.syncMetaData()
public Lock obtainLock(java.lang.String name)
Directory
Lock
for a file with the given name.obtainLock
in class Directory
name
- the name of the lock filepublic java.util.Set<java.lang.String> getPendingDeletions()
Directory
getPendingDeletions
in class Directory