|
Mobios v0.91 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface Store
A store is a resource where areas can be allocated and freed to store objects. A store can be backed by a file or main memory, or a combination of the two.
Some characteristics of implementations of Store may be separately specified. For example, a file based store that is intended to persistently store objects may have robustness as a primary requirement. A main memory based store, or other type of volatile store, may not require robustness.
| Method Summary | |
|---|---|
long |
alloc(long size)
Allocates a block of memory out of the store of the specified size, and returns a pointer to the block. |
void |
flush()
Flushes any changes to the underlying storage device if the store implements memory mapping or buffering. |
void |
free(long pointer)
Frees a block of memory from the store that was previously allocated via 'alloc'. |
List |
getAllAreas()
Returns a complete list of pointers to all areas in the Store as Long objects sorted from lowest pointer to highest. |
Area |
getArea(long pointer)
Returns an Area object that can be used to manipulate an area allocated from the store. |
Area |
getFixedArea()
Returns an Area object that represents the 64 byte fixed area as can be changed by the 'getFixedArea' and 'setFixedArea' methods. |
InputStream |
getInputStream(long pointer)
Returns an InputStream for reading from the area of the store allocated via the 'alloc' method. |
OutputStream |
getOutputStream(long pointer)
Returns an OutputStream for writing to the area of the store allocated via the 'alloc' method. |
boolean |
lastCloseClean()
Returns true if the store was closed cleanly. |
void |
synch()
Flushes and synchronizes any changes made to the store with the underlying persistent device. |
| Method Detail |
|---|
long alloc(long size)
throws IOException
size - the amount of memory to allocate.
IOException - is the allocation can not happen.
void free(long pointer)
throws IOException
pointer - a 64-bit pointer to the memory to free.
IOException
Area getFixedArea()
throws IOException
IOException
InputStream getInputStream(long pointer)
throws IOException
The returned stream does not perform buffering. For efficiency, it is a good idea to wrap the returned steam with a BufferedInputStream.
pointer - a 64-bit pointer to the memory to read.
IOException
OutputStream getOutputStream(long pointer)
throws IOException
The returned stream does not perform buffering. For efficiency, it is a good idea to wrap the returned steam with a BufferedOutputStream.
pointer - a 64-bit pointer to the memory to write.
IOException
Area getArea(long pointer)
throws IOException
pointer - a 64-bit pointer to the area (allocated via 'alloc').
IOException
void flush()
throws IOException
IOException
void synch()
throws IOException
IOExceptionboolean lastCloseClean()
List getAllAreas()
throws IOException
IOException
|
Mobios v0.91 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||