org.apache.lucene.store.bytebuffer
Class ByteBufferDirectory
java.lang.Object
org.apache.lucene.store.Directory
org.apache.lucene.store.bytebuffer.ByteBufferDirectory
- All Implemented Interfaces:
- java.io.Closeable
public class ByteBufferDirectory
- extends org.apache.lucene.store.Directory
A memory based directory that uses ByteBuffer
in order to store the directory content.
The benefit of using ByteBuffer
is the fact that it can be stored in "native" memory
outside of the JVM heap, thus not incurring the GC overhead of large in memory index.
Each "file" is segmented into one or more byte buffers.
If constructed with ByteBufferAllocator
, it allows to control the allocation and release of
byte buffer. For example, custom implementations can include caching of byte buffers.
Fields inherited from class org.apache.lucene.store.Directory |
isOpen, lockFactory |
Method Summary |
void |
close()
|
org.apache.lucene.store.IndexOutput |
createOutput(java.lang.String name)
|
void |
deleteFile(java.lang.String name)
|
boolean |
fileExists(java.lang.String name)
|
long |
fileLength(java.lang.String name)
|
long |
fileModified(java.lang.String name)
|
java.lang.String[] |
listAll()
|
org.apache.lucene.store.IndexInput |
openInput(java.lang.String name)
|
void |
sync(java.util.Collection<java.lang.String> names)
|
void |
touchFile(java.lang.String name)
|
Methods inherited from class org.apache.lucene.store.Directory |
clearLock, copy, copy, ensureOpen, getLockFactory, getLockID, makeLock, openInput, setLockFactory, sync, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
files
protected final java.util.Map<java.lang.String,ByteBufferFile> files
ByteBufferDirectory
public ByteBufferDirectory()
- Constructs a new directory using
PlainByteBufferAllocator
.
ByteBufferDirectory
public ByteBufferDirectory(ByteBufferAllocator allocator)
- Constructs a new byte buffer directory with a custom allocator.
sync
public void sync(java.util.Collection<java.lang.String> names)
throws java.io.IOException
- Overrides:
sync
in class org.apache.lucene.store.Directory
- Throws:
java.io.IOException
listAll
public java.lang.String[] listAll()
throws java.io.IOException
- Specified by:
listAll
in class org.apache.lucene.store.Directory
- Throws:
java.io.IOException
fileExists
public boolean fileExists(java.lang.String name)
throws java.io.IOException
- Specified by:
fileExists
in class org.apache.lucene.store.Directory
- Throws:
java.io.IOException
fileModified
public long fileModified(java.lang.String name)
throws java.io.IOException
- Specified by:
fileModified
in class org.apache.lucene.store.Directory
- Throws:
java.io.IOException
touchFile
public void touchFile(java.lang.String name)
throws java.io.IOException
- Specified by:
touchFile
in class org.apache.lucene.store.Directory
- Throws:
java.io.IOException
deleteFile
public void deleteFile(java.lang.String name)
throws java.io.IOException
- Specified by:
deleteFile
in class org.apache.lucene.store.Directory
- Throws:
java.io.IOException
fileLength
public long fileLength(java.lang.String name)
throws java.io.IOException
- Specified by:
fileLength
in class org.apache.lucene.store.Directory
- Throws:
java.io.IOException
createOutput
public org.apache.lucene.store.IndexOutput createOutput(java.lang.String name)
throws java.io.IOException
- Specified by:
createOutput
in class org.apache.lucene.store.Directory
- Throws:
java.io.IOException
openInput
public org.apache.lucene.store.IndexInput openInput(java.lang.String name)
throws java.io.IOException
- Specified by:
openInput
in class org.apache.lucene.store.Directory
- Throws:
java.io.IOException
close
public void close()
throws java.io.IOException
- Specified by:
close
in interface java.io.Closeable
- Specified by:
close
in class org.apache.lucene.store.Directory
- Throws:
java.io.IOException