public class Immutable extends Object
Constructor and Description |
---|
Immutable()
Creates a new instance of Immutable.
|
Immutable(String identifier)
Constructs an
Immutable object for the block with the specified identifier. |
Modifier and Type | Method and Description |
---|---|
void |
close()
Ends access to a previously opened/created immutable block.
|
void |
create(String identifier,
int size)
Creates a new immutable block and associates that block with the specified identifier.
|
static boolean[] |
createBooleanArray(String identifier,
int size)
Constructs an immutable boolean[] with the given identifier (GUID).
|
static byte[] |
createByteArray(String identifier,
int size)
Constructs an immutable byte[] with the given identifier (GUID).
|
static char[] |
createCharArray(String identifier,
int size)
Constructs an immutable char[] with the given identifier (GUID).
|
static double[] |
createDoubleArray(String identifier,
int size)
Constructs an immutable double[] with the given identifier (GUID).
|
static float[] |
createFloatArray(String identifier,
int size)
Constructs an immutable float[] with the given identifier (GUID).
|
static int[] |
createIntArray(String identifier,
int size)
Constructs an immutable int[] with the given identifier (GUID).
|
static long[] |
createLongArray(String identifier,
int size)
Constructs an immutable long[] with the given identifier (GUID).
|
static short[] |
createShortArray(String identifier,
int size)
Constructs an immutable short[] with the given identifier (GUID).
|
boolean |
exists(String identifier)
Determines if the specified block exists.
|
static Object |
getArray(String identifier)
Returns the immutable Object associated with the given identifier.
|
static boolean[] |
getBooleanArray(String identifier)
Returns the immutable boolean[] associated with the given identifier.
|
static byte[] |
getByteArray(String identifier)
Returns the immutable byte[] associated with the given identifier.
|
static char[] |
getCharArray(String identifier)
Returns the immutable char[] associated with the given identifier.
|
static double[] |
getDoubleArray(String identifier)
Returns the immutable double[] associated with the given identifier.
|
static float[] |
getFloatArray(String identifier)
Returns the immutable float[] associated with the given identifier.
|
static int[] |
getIntArray(String identifier)
Returns the immutable int[] associated with the given identifier.
|
static long[] |
getLongArray(String identifier)
Returns the immutable long[] associated with the given identifier.
|
static short[] |
getShortArray(String identifier)
Returns the immutable short[] associated with the given identifier.
|
boolean |
isOpen()
Check open status.
|
void |
open(String identifier)
Opens an existing Immutable block that had once been created with the specified 8 character identifier.
|
int |
read(int address)
Deprecated.
as of JANOS
|
byte |
readByte(int address)
Reads a byte from the immutable block.
|
void |
readBytes(int address,
byte[] array,
int offset,
int count)
Reads an array of bytes from the immutable block.
|
int |
readInt(int address)
Reads an int from the immutable block.
|
long |
readLong(int address)
Reads a long from the immutable block.
|
short |
readShort(int address)
Reads a short from the immutable block.
|
static void |
remove(String identifier)
Removes the specified immutable block from the heap.
|
int |
size()
Returns the size of the immutable block.
|
void |
write(int address,
int value)
Deprecated.
as of JANOS throw the exception if the block is not open.
|
void |
writeByte(int address,
byte value)
Writes a byte to the given address.
|
void |
writeBytes(int address,
byte[] array,
int offset,
int count)
Writes an array of bytes to the given address from the supplied byte[] starting with the byte at offset for count bytes.
|
void |
writeInt(int address,
int value)
Writes an int value to the immutable block.
|
void |
writeLong(int address,
long value)
Writes a long value to the immutable block.
|
void |
writeShort(int address,
short value)
Sets a 2-byte short value at the specified address.
|
public Immutable()
public Immutable(String identifier) throws IOException
Immutable
object for the block with the specified identifier.identifier
- an 8 character String that will uniquely identify this Immutable block. This must be exactly 8
characters in length.IOException
- if the Immutable is already open or if a block with the specified
identifier does not exit.public static Object getArray(String identifier)
identifier
- an 8 character String that will uniquely identify this Immutable block.public static boolean[] createBooleanArray(String identifier, int size)
identifier
- an 8 character String that will uniquely identify this Immutable block.size
- count of elements in the new arraypublic static boolean[] getBooleanArray(String identifier)
identifier
- an 8 character String that will uniquely identify this Immutable block.public static char[] createCharArray(String identifier, int size)
identifier
- an 8 character String that will uniquely identify this Immutable block.size
- count of elements in the new arraypublic static char[] getCharArray(String identifier)
identifier
- an 8 character String that will uniquely identify this Immutable block.public static byte[] createByteArray(String identifier, int size)
identifier
- an 8 character String that will uniquely identify this Immutable block.size
- count of elements in the new arraypublic static byte[] getByteArray(String identifier)
identifier
- an 8 character String that will uniquely identify this Immutable block.public static short[] createShortArray(String identifier, int size)
identifier
- an 8 character String that will uniquely identify this Immutable block.size
- count of elements in the new arraypublic static short[] getShortArray(String identifier)
identifier
- an 8 character String that will uniquely identify this Immutable block.public static int[] createIntArray(String identifier, int size)
identifier
- an 8 character String that will uniquely identify this Immutable block.size
- count of elements in the new arraypublic static int[] getIntArray(String identifier)
identifier
- an 8 character String that will uniquely identify this Immutable block.public static long[] createLongArray(String identifier, int size)
identifier
- an 8 character String that will uniquely identify this Immutable block.size
- count of elements in the new arraypublic static long[] getLongArray(String identifier)
identifier
- an 8 character String that will uniquely identify this Immutable block.public static float[] createFloatArray(String identifier, int size)
identifier
- an 8 character String that will uniquely identify this Immutable block.size
- count of elements in the new arraypublic static float[] getFloatArray(String identifier)
identifier
- an 8 character String that will uniquely identify this Immutable block.public static double[] createDoubleArray(String identifier, int size)
identifier
- an 8 character String that will uniquely identify this Immutable block.size
- count of elements in the new arraypublic static double[] getDoubleArray(String identifier)
identifier
- an 8 character String that will uniquely identify this Immutable block.public boolean exists(String identifier)
identifier
- An 8 character String that will uniquely identify this Immutable block. This must be exactly 8
characters in length.true
if the block exists and false
otherwise.public void open(String identifier) throws IOException
identifier
- An 8 character String that will uniquely identify this Immutable block. This must be exactly 8
characters in length.IOException
- If the Immutable is already open or if a block with the specified
identifier does not exit.public void close()
public boolean isOpen()
public void create(String identifier, int size) throws IOException
identifier
- 8 character identification string to be associated with the new immutable block. This must be exactly 8
characters in length of an IOException will be thrown.size
- Defines the size of the new immutable block. As there is some minimal header information stored with the
block the size is limited to just under 64Kb.IOException
- The exception is thrown if the identifier is not exactly 8 characters in length. An exception will
occur if the requested block cannot be created.public static void remove(String identifier)
identifier
- 8 character string identifying an previously created immutable block.public void writeBytes(int address, byte[] array, int offset, int count)
address
- Specifies the destination address within the immutable block.array
- The byte[] containing the data to be written.offset
- The offset in the byte[] defining the beginning of the data.count
- The total length of the transfer.public int read(int address)
address
- Specifies that address in the immutable block to be retrieved.public byte readByte(int address)
address
- Specifies that address in the immutable block to be retrieved.public short readShort(int address)
address
- Specifies that address in the immutable block to be retrieved.public int readInt(int address)
address
- Specifies that address in the immutable block to be retrieved.public long readLong(int address)
address
- Specifies that address in the immutable block to be retrieved.public void readBytes(int address, byte[] array, int offset, int count)
address
- Specifies that address in the immutable block at the start of the data to be retrieved.array
- The destination byte[].offset
- The offset in the destination byte[] which will receive the data.count
- The total length of the transfer. write beyond the bounds of the byte[].public void write(int address, int value)
address
- Specifies the destination address within the immutable block.value
- The byte to be written.public void writeByte(int address, byte value)
address
- Specifies the destination address within the immutable block.value
- The byte to be written. throw the exception if the block is not open.public void writeShort(int address, short value)
address
- The location of the short value in the immutable block.value
- Short value to be written.public void writeInt(int address, int value)
address
- The destination location in the immutable block.value
- The int to be written.public void writeLong(int address, long value)
address
- The destination location in the immutable block.value
- The long value to be writtenpublic int size()