|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object josx.platform.rcx.PersistentMemoryArea
A memory area for persistent storage. The memory persists between runs of a program. Downloading a new program will trash the area (unless you're very lucky).
The magic number should be different for each application (use a random integer).
At the moment there can be only one PersistentMemoryArea, that will be reinitialized if you change the magic number. This may change in the future, with more than one area and magic number used to distinguish them.
In case you experience problems, the specific restrictions are as follows (which might help you fix the problem):
Method Summary | |
static PersistentMemoryArea |
get(int magic,
int size)
Allocate a persistent array of 'size' bytes. |
byte |
readByte(int i)
Read the byte at index 'i' |
void |
writeByte(int i,
byte b)
Write a byte at index 'i' |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait |
Method Detail |
public static PersistentMemoryArea get(int magic, int size) throws OutOfMemoryError
magic
- a 2 byte integer used to idenitfy the specific memory area.size
- the size in bytes. This should be in the range 0 thru 511.
OutOfMemoryError
- not enoug memory to allocate the array.public byte readByte(int i) throws ArrayIndexOutOfBoundsException
i
- the index starting at 0.
ArrayIndexOutOfBoundsException
- if the index is
out of bounds.public void writeByte(int i, byte b) throws ArrayIndexOutOfBoundsException
i
- the index starting at 0.b
- the byte value.
ArrayIndexOutOfBoundsException
- if the index is
out of bounds.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |