| java.lang.Object com.db4o.io.IoAdapter com.db4o.io.MemoryIoAdapter
MemoryIoAdapter | public class MemoryIoAdapter extends IoAdapter (Code) | | IoAdapter for in-memory operation.
Configure db4o to operate with this in-memory IoAdapter with
MemoryIoAdapter memoryIoAdapter = new MemoryIoAdapter();
Db4o.configure().io(memoryIoAdapter);
Use the normal #openFile() and #openServer() commands to open
ObjectContainers and ObjectServers. The names specified as file names will be
used to identify the byte[] content of the in-memory files in
the _memoryFiles Hashtable in the adapter. After working with an in-memory
ObjectContainer/ObjectServer the byte[] content is available
in the MemoryIoAdapter by using
MemoryIoAdapter.get(String) . To add old existing
database byte[] content to a MemoryIoAdapter use
MemoryIoAdapter.put(String,byte[]) . To reduce memory consumption of memory file
names that will no longer be used call
MemoryIoAdapter.put(String,byte[]) and pass
an empty byte array.
|
Method Summary | |
public void | close() for internal processing only. | public void | delete(String path) | public boolean | exists(String path) for internal processing only. | public byte[] | get(String name) returns the content bytes for a database with the given name. | public long | getLength() for internal processing only. | public void | growBy(int length) configures the length a memory file should grow, if no more free slots
are found within. | public IoAdapter | open(String path, boolean lockFile, long initialLength, boolean readOnly) for internal processing only. | public void | put(String name, byte[] bytes) creates an in-memory database with the passed content bytes and adds it
to the adapter for the specified name. | public int | read(byte[] bytes, int length) for internal processing only. | public void | seek(long pos) for internal processing only. | public void | sync() for internal processing only. | public void | write(byte[] buffer, int length) for internal processing only. |
MemoryIoAdapter | public MemoryIoAdapter()(Code) | | |
exists | public boolean exists(String path)(Code) | | for internal processing only.
|
get | public byte[] get(String name)(Code) | | returns the content bytes for a database with the given name.
Parameters: name - the name to be use for #openFile() or #openServer() calls the content bytes |
growBy | public void growBy(int length)(Code) | | configures the length a memory file should grow, if no more free slots
are found within.
Specify a large value (100,000 or more) for best performance. Specify a
small value (100) for the smallest memory consumption. The default
setting is 10,000.
Parameters: length - the length in bytes |
put | public void put(String name, byte[] bytes)(Code) | | creates an in-memory database with the passed content bytes and adds it
to the adapter for the specified name.
Parameters: name - the name to be use for #openFile() or #openServer() calls Parameters: bytes - the database content |
write | public void write(byte[] buffer, int length) throws Db4oIOException(Code) | | for internal processing only.
|
Methods inherited from com.db4o.io.IoAdapter | public void blockCopy(int oldAddress, int oldAddressOffset, int newAddress, int newAddressOffset, int length) throws Db4oIOException(Code)(Java Doc) public void blockSeek(int address) throws Db4oIOException(Code)(Java Doc) public void blockSeek(int address, int offset) throws Db4oIOException(Code)(Java Doc) public void blockSize(int blockSize)(Code)(Java Doc) public int blockSize()(Code)(Java Doc) abstract public void close() throws Db4oIOException(Code)(Java Doc) public void copy(long oldAddress, long newAddress, int length) throws Db4oIOException(Code)(Java Doc) public IoAdapter delegatedIoAdapter()(Code)(Java Doc) abstract public void delete(String path)(Code)(Java Doc) abstract public boolean exists(String path)(Code)(Java Doc) abstract public long getLength() throws Db4oIOException(Code)(Java Doc) abstract public IoAdapter open(String path, boolean lockFile, long initialLength, boolean readOnly) throws Db4oIOException(Code)(Java Doc) public int read(byte[] buffer) throws Db4oIOException(Code)(Java Doc) abstract public int read(byte[] bytes, int length) throws Db4oIOException(Code)(Java Doc) final protected long regularAddress(int blockAddress, int blockAddressOffset)(Code)(Java Doc) abstract public void seek(long pos) throws Db4oIOException(Code)(Java Doc) abstract public void sync() throws Db4oIOException(Code)(Java Doc) public void write(byte[] bytes) throws Db4oIOException(Code)(Java Doc) abstract public void write(byte[] buffer, int length) throws Db4oIOException(Code)(Java Doc)
|
|
|