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.
| Method from org.apache.lucene.index.CompoundFileReader Detail: |
public synchronized void close() throws IOException {
if (stream == null)
throw new IOException("Already closed");
entries.clear();
stream.close();
stream = null;
}
|
public IndexOutput createOutput(String name) {
throw new UnsupportedOperationException();
}
|
public void deleteFile(String name) {
throw new UnsupportedOperationException();
}
|
public boolean fileExists(String name) {
return entries.containsKey(name);
}
Returns true iff a file with the given name exists. |
public long fileLength(String name) throws IOException {
FileEntry e = (FileEntry) entries.get(name);
if (e == null)
throw new IOException("File " + name + " does not exist");
return e.length;
}
Returns the length of a file in the directory. |
public long fileModified(String name) throws IOException {
return directory.fileModified(fileName);
}
Returns the time the compound file was last modified. |
public Directory getDirectory() {
return directory;
}
|
public String getName() {
return fileName;
}
|
public String[] list() {
String res[] = new String[entries.size()];
return (String[]) entries.keySet().toArray(res);
}
Returns an array of strings, one for each file in the directory. |
public Lock makeLock(String name) {
throw new UnsupportedOperationException();
}
|
public synchronized IndexInput openInput(String id) throws IOException {
// Default to readBufferSize passed in when we were opened
return openInput(id, readBufferSize);
}
|
public synchronized IndexInput openInput(String id,
int readBufferSize) throws IOException {
if (stream == null)
throw new IOException("Stream closed");
FileEntry entry = (FileEntry) entries.get(id);
if (entry == null)
throw new IOException("No sub-file with id " + id + " found");
return new CSIndexInput(stream, entry.offset, entry.length, readBufferSize);
}
|
public void renameFile(String from,
String to) {
throw new UnsupportedOperationException();
}
|
public void touchFile(String name) throws IOException {
directory.touchFile(fileName);
}
Set the modified time of the compound file to now. |