fr.umlv.corosol.memory
Interface JMemory

All Superinterfaces:
JObject
All Known Subinterfaces:
JHeap
All Known Implementing Classes:
DefaultJHeap, JTypedHeap, JTypedMemory

public interface JMemory
extends JObject

A memory area in the Corosol JVM. The JMemory interface provides methods for reading and writing each Java primitive type value into this memory.

Author:
Christophe Deleray

Method Summary
 boolean readBoolean(int index)
          Reads a boolean value starting at the specified position in this memory.
 byte readByte(int index)
          Reads one byte at the specified position in this memory.
 char readChar(int index)
          Reads a char value starting at the specified position in this memory.
 double readDouble(int index)
          Reads a double value starting at the specified position in this memory.
 float readFloat(int index)
          Reads a float value starting at the specified position in this memory.
 int readInt(int index)
          Reads an int value starting at the specified position in this memory.
 long readLong(int index)
          Reads a long value starting at the specified position in this memory.
 JHeapObject readReference(int index)
          Reads a reference value starting at the specified position in this memory and returns the object it referents to.
 short readShort(int index)
          Reads a short value starting at the specified position in this memory.
 int size()
          Returns the number of bytes composing this memory.
 int sizeof(JClass type)
          Returns the number of bytes of the specified type.
 void writeBoolean(int index, boolean value)
          Writes the specified boolean value at the specified position in this memory.
 void writeByte(int index, byte value)
          Writes the specified byte value at the specified position in this memory.
 void writeChar(int index, char value)
          Writes the specified char value at the specified position in this memory.
 void writeDouble(int index, double value)
          Writes the specified double at the specified position in this memory.
 void writeFloat(int index, float value)
          Writes the specified float at the specified position in this memory.
 void writeInt(int index, int value)
          Writes the specified int value at the specified position in this memory.
 void writeLong(int index, long value)
          Writes the specified long at the specified position in this memory.
 void writeReference(int index, JHeapObject object)
          Writes the reference of the specified object at the specified position in this memory.
 void writeShort(int index, short value)
          Writes the specified short value at the specified position in this memory.
 

Method Detail

readByte

byte readByte(int index)
Reads one byte at the specified position in this memory.

Parameters:
index - index at which the byte is to be read
Returns:
a byte value

readBoolean

boolean readBoolean(int index)
Reads a boolean value starting at the specified position in this memory.

Parameters:
index - index at which the boolean value is to be read
Returns:
a boolean value

readShort

short readShort(int index)
Reads a short value starting at the specified position in this memory.

Parameters:
index - index at which the short value is to be read
Returns:
a short value

readChar

char readChar(int index)
Reads a char value starting at the specified position in this memory.

Parameters:
index - index at which the char value is to be read
Returns:
a char value

readInt

int readInt(int index)
Reads an int value starting at the specified position in this memory.

Parameters:
index - index at which the int value is to be read
Returns:
a int value

readFloat

float readFloat(int index)
Reads a float value starting at the specified position in this memory.

Parameters:
index - index at which the float value is to be read
Returns:
a float value

readLong

long readLong(int index)
Reads a long value starting at the specified position in this memory.

Parameters:
index - index at which the long value is to be read
Returns:
a long value

readDouble

double readDouble(int index)
Reads a double value starting at the specified position in this memory.

Parameters:
index - index at which the double value is to be read
Returns:
a double value

readReference

JHeapObject readReference(int index)
Reads a reference value starting at the specified position in this memory and returns the object it referents to.

Parameters:
index - index at which the reference value is to be read
Returns:
the object which the reference is read in this memory

writeByte

void writeByte(int index,
               byte value)
Writes the specified byte value at the specified position in this memory.

Parameters:
index - index at which the byte value is to be writed
value - the byte value to be writed in this memory

writeBoolean

void writeBoolean(int index,
                  boolean value)
Writes the specified boolean value at the specified position in this memory.

Parameters:
index - index at which the boolean value is to be writed
value - the boolean value to be writed in this memory

writeChar

void writeChar(int index,
               char value)
Writes the specified char value at the specified position in this memory.

Parameters:
index - index at which the char value is to be writed
value - the char value to be writed in this memory

writeShort

void writeShort(int index,
                short value)
Writes the specified short value at the specified position in this memory.

Parameters:
index - index at which the short value is to be writed
value - the short value to be writed in this memory

writeInt

void writeInt(int index,
              int value)
Writes the specified int value at the specified position in this memory.

Parameters:
index - index at which the int value is to be writed
value - the int value to be writed in this memory

writeFloat

void writeFloat(int index,
                float value)
Writes the specified float at the specified position in this memory.

Parameters:
index - index at which the float value is to be writed
value - the float value to be writed in this memory

writeLong

void writeLong(int index,
               long value)
Writes the specified long at the specified position in this memory.

Parameters:
index - index at which the long value is to be writed
value - the long value to be writed in this memory

writeDouble

void writeDouble(int index,
                 double value)
Writes the specified double at the specified position in this memory.

Parameters:
index - index at which the double value is to be writed
value - the double value to be writed in this memory

writeReference

void writeReference(int index,
                    JHeapObject object)
Writes the reference of the specified object at the specified position in this memory.

Parameters:
index - index at which the reference value is to be writed
object - the object which reference is to be writed in this memory

size

int size()
Returns the number of bytes composing this memory.

Returns:
the number of bytes composing this memory

sizeof

int sizeof(JClass type)
Returns the number of bytes of the specified type.

Parameters:
type - a class representing a Java type
Returns:
the number of bytes of the specified type