db4o 6.1

com.db4o.ext
Class MemoryFile

java.lang.Object
  extended by com.db4o.ext.MemoryFile

public class MemoryFile
extends java.lang.Object

carries in-memory data for db4o in-memory operation.

In-memory ObjectContainers are useful for maximum performance on small databases, for swapping objects or for storing db4o format data to other media or other databases.

Be aware of the danger of running into OutOfMemory problems or complete loss of all data, in case of hardware or JVM failures.

See Also:
ExtDb4o.openMemoryFile(com.db4o.ext.MemoryFile)

Constructor Summary
MemoryFile()
          constructs a new MemoryFile without any data.
MemoryFile(byte[] bytes)
          constructs a MemoryFile to use the byte data from a previous MemoryFile.
 
Method Summary
 byte[] getBytes()
          returns the raw byte data.
 int getIncrementSizeBy()
          returns the size the MemoryFile is to be enlarged, if it grows beyond the current size.
 int getInitialSize()
          returns the initial size of the MemoryFile.
 void setBytes(byte[] bytes)
          sets the raw byte data.
 void setIncrementSizeBy(int byteCount)
          configures the size the MemoryFile is to be enlarged by, if it grows beyond the current size.
 void setInitialSize(int byteCount)
          configures the initial size of the MemoryFile.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MemoryFile

public MemoryFile()
constructs a new MemoryFile without any data.

See Also:
ExtDb4o.openMemoryFile(com.db4o.ext.MemoryFile)

MemoryFile

public MemoryFile(byte[] bytes)
constructs a MemoryFile to use the byte data from a previous MemoryFile.

Parameters:
bytes - the raw byte data.
See Also:
ExtDb4o.openMemoryFile(com.db4o.ext.MemoryFile)
Method Detail

getBytes

public byte[] getBytes()
returns the raw byte data.

Use this method to get the byte data from the MemoryFile to store it to other media or databases, for backup purposes or to create other MemoryFile sessions.

The byte data from a MemoryFile should only be used after it is closed.

Returns:
bytes the raw byte data.

getIncrementSizeBy

public int getIncrementSizeBy()
returns the size the MemoryFile is to be enlarged, if it grows beyond the current size.

Returns:
size in bytes

getInitialSize

public int getInitialSize()
returns the initial size of the MemoryFile.

Returns:
size in bytes

setBytes

public void setBytes(byte[] bytes)
sets the raw byte data.

Caution!
Calling this method during a running Memory File session may produce unpreditable results.

Parameters:
bytes - the raw byte data.

setIncrementSizeBy

public void setIncrementSizeBy(int byteCount)
configures the size the MemoryFile is to be enlarged by, if it grows beyond the current size.

Call this method before passing the MemoryFile to ExtDb4o#openMemoryFile(MemoryFile).

This parameter can be modified to tune the maximum performance of a MemoryFile for a specific usecase. To produce the best results, test the speed of your application with real data.

Parameters:
byteCount - the desired size in bytes

setInitialSize

public void setInitialSize(int byteCount)
configures the initial size of the MemoryFile.

Call this method before passing the MemoryFile to ExtDb4o#openMemoryFile(MemoryFile).

This parameter can be modified to tune the maximum performance of a MemoryFile for a specific usecase. To produce the best results, test speed and memory consumption of your application with real data.

Parameters:
byteCount - the desired size in bytes

db4o 6.1