| Constructor and Description |
|---|
RAMDirectory()
Constructs an empty
Directory. |
RAMDirectory(Directory dir)
Creates a new
RAMDirectory instance from a different
Directory implementation. |
RAMDirectory(File dir)
Creates a new
RAMDirectory instance from the FSDirectory. |
RAMDirectory(String dir)
Creates a new
RAMDirectory instance from the FSDirectory. |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the store to future operations.
|
OutputStream |
createFile(String name)
Creates a new, empty file in the directory with the given name.
|
void |
deleteFile(String name)
Removes an existing file in the directory.
|
boolean |
fileExists(String name)
Returns true iff the named file exists in this directory.
|
long |
fileLength(String name)
Returns the length in bytes of a file in the directory.
|
long |
fileModified(String name)
Returns the time the named file was last modified.
|
String[] |
list()
Returns an array of strings, one for each file in the directory.
|
Lock |
makeLock(String name)
Construct a
Lock. |
InputStream |
openFile(String name)
Returns a stream reading an existing file.
|
void |
renameFile(String from,
String to)
Removes an existing file in the directory.
|
void |
touchFile(String name)
Set the modified time of an existing file to now.
|
public RAMDirectory()
Directory.public RAMDirectory(Directory dir) throws IOException
RAMDirectory instance from a different
Directory implementation. This can be used to load
a disk-based index into memory.
This should be used only with indices that can fit into memory.
dir - a Directory valueIOException - if an error occurspublic RAMDirectory(File dir) throws IOException
RAMDirectory instance from the FSDirectory.dir - a File specifying the index directoryIOExceptionpublic RAMDirectory(String dir) throws IOException
RAMDirectory instance from the FSDirectory.dir - a String specifying the full index directory pathIOExceptionpublic final String[] list()
public final boolean fileExists(String name)
fileExists in class Directorypublic final long fileModified(String name) throws IOException
fileModified in class DirectoryIOExceptionpublic void touchFile(String name) throws IOException
touchFile in class DirectoryIOExceptionpublic final long fileLength(String name)
fileLength in class Directorypublic final void deleteFile(String name)
deleteFile in class Directorypublic final void renameFile(String from, String to)
renameFile in class Directorypublic final OutputStream createFile(String name)
createFile in class Directorypublic final InputStream openFile(String name)
Copyright © 2024 GATE. All rights reserved.