|
db4o 6.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.db4o.io.IoAdapter
com.db4o.io.MemoryIoAdapter
public class MemoryIoAdapter
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
get(String)
. To add old existing database
byte[]
content to a MemoryIoAdapter use
put(String, byte[])
. To reduce memory consumption of memory
file names that will no longer be used call put(String, byte[])
and pass an empty byte array.
Constructor Summary | |
---|---|
MemoryIoAdapter()
|
Method Summary | |
---|---|
void |
close()
for internal processing only. |
void |
delete(java.lang.String path)
deletes the given path from whatever 'file system' is addressed |
boolean |
exists(java.lang.String path)
for internal processing only. |
byte[] |
get(java.lang.String name)
returns the content bytes for a database with the given name. |
long |
getLength()
for internal processing only. |
void |
growBy(int length)
configures the length a memory file should grow, if no more free slots are found within. |
IoAdapter |
open(java.lang.String path,
boolean lockFile,
long initialLength)
for internal processing only. |
void |
put(java.lang.String name,
byte[] bytes)
creates an in-memory database with the passed content bytes and adds it to the adapter for the specified name. |
int |
read(byte[] bytes,
int length)
for internal processing only. |
void |
seek(long pos)
for internal processing only. |
void |
sync()
for internal processing only. |
void |
write(byte[] buffer,
int length)
for internal processing only. |
Methods inherited from class com.db4o.io.IoAdapter |
---|
blockCopy, blockSeek, blockSeek, blockSize, blockSize, copy, delegatedIoAdapter, read, write |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MemoryIoAdapter()
Method Detail |
---|
public void put(java.lang.String name, byte[] bytes)
name
- the name to be use for #openFile() or #openServer() callsbytes
- the database contentpublic byte[] get(java.lang.String name)
name
- the name to be use for #openFile() or #openServer() calls
public void growBy(int length)
length
- the length in bytespublic void close() throws java.io.IOException
close
in class IoAdapter
java.io.IOException
public void delete(java.lang.String path)
IoAdapter
delete
in class IoAdapter
public boolean exists(java.lang.String path)
exists
in class IoAdapter
public long getLength() throws java.io.IOException
getLength
in class IoAdapter
java.io.IOException
public IoAdapter open(java.lang.String path, boolean lockFile, long initialLength) throws java.io.IOException
open
in class IoAdapter
java.io.IOException
public int read(byte[] bytes, int length) throws java.io.IOException
read
in class IoAdapter
java.io.IOException
public void seek(long pos) throws java.io.IOException
seek
in class IoAdapter
java.io.IOException
public void sync() throws java.io.IOException
sync
in class IoAdapter
java.io.IOException
public void write(byte[] buffer, int length) throws java.io.IOException
write
in class IoAdapter
java.io.IOException
|
db4o 6.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |