|
db4o 7.4 | ||||||||
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()
|
|
MemoryIoAdapter(int initialLength)
|
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,
boolean readOnly)
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()
public MemoryIoAdapter(int initialLength)
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 Db4oIOException
close
in class IoAdapter
Db4oIOException
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 Db4oIOException
getLength
in class IoAdapter
Db4oIOException
public IoAdapter open(java.lang.String path, boolean lockFile, long initialLength, boolean readOnly) throws Db4oIOException
open
in class IoAdapter
Db4oIOException
public int read(byte[] bytes, int length) throws Db4oIOException
read
in class IoAdapter
Db4oIOException
public void seek(long pos) throws Db4oIOException
seek
in class IoAdapter
Db4oIOException
public void sync() throws Db4oIOException
sync
in class IoAdapter
Db4oIOException
public void write(byte[] buffer, int length) throws Db4oIOException
write
in class IoAdapter
Db4oIOException
|
db4o 7.4 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |