|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.smardec.j2native.Argument | +--com.smardec.j2native.ArrayArgument
ArrayArgument
class represents an array of primitive types
such as array of bytes or array of integer values.
All array items are instances of the same class
Field Summary |
Fields inherited from class com.smardec.j2native.Argument |
JAVA_SIDE, NATIVE_SIDE |
Constructor Summary | |
ArrayArgument(Argument[] elements)
Constructs an array object taking a specified Argument array. |
|
ArrayArgument(Argument sample,
int arrayLength)
Constructs an array object of specified length. |
|
ArrayArgument(java.lang.Class arrayType,
int arrayLength)
Constructs an array of objects of a specified class and size. |
Method Summary | |
void |
fromArgumentsArray(Argument[] arguments)
Sets array contents to the given values. |
void |
fromBytesValue(byte[] bytes,
int offset)
Restores itself from provided array of bytes. |
Argument |
getElement(int index)
Returns an array item specified by an index. |
int |
getElementsCount()
Returns the number of elements in the array. |
int |
getLength()
Returns length in bytes. |
protected boolean |
isFixedLength()
Identify if Argument is a fixed length variable. |
protected void |
read(long handle,
int offset)
Reads itself from the memory. |
protected void |
readFromStack(byte[] stack,
int offset)
Read itself from stack. |
void |
setElement(int index,
Argument argument)
Replaces an array item with the specified object. |
void |
setElementsCount(int newLength)
Resizes this array to a given size. |
Argument[] |
toArgumentsArray()
Returns items as Java array. |
byte[] |
toBytesValue()
Encodes itself and returns it's representation as array of bytes. |
protected void |
toBytesValue(byte[] bytes,
int offset)
Encodes itself to the provided array of bytes. |
protected void |
update(byte side)
This method is used to synchronize Java side and native part. |
protected void |
write(long handle,
int offset)
Writes itself to the memory. |
protected void |
writeToStack(byte[] stack,
int offset)
Writes itself to stack. |
Methods inherited from class com.smardec.j2native.Argument |
clone, finalize, free, getAlignedLength, getResultFlags, readFromRAM, restoreFromRAM, storeToRAM, writeToRAM |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ArrayArgument(java.lang.Class arrayType, int arrayLength)
null
), so you have to do it
arrayType
- class for items in the constructed arrayarrayLength
- count of items in the constructed arraypublic ArrayArgument(Argument sample, int arrayLength)
null
),
so you have to do it.
sample
- a sample for items in the constructed arrayarrayLength
- count of items in the constructed arraypublic ArrayArgument(Argument[] elements)
Argument
array.
elements
- Argument[]
array ot the new valuesMethod Detail |
public Argument getElement(int index)
ArrayType
getElement
in interface ArrayType
index
- index of a requested array item
Argument
itempublic void setElement(int index, Argument argument) throws java.lang.ArrayStoreException
ArrayType
setElement
in interface ArrayType
index
- index of an item to be replacedargument
- object to be set as array item
java.lang.ArrayStoreException
public int getElementsCount()
ArrayType
getElementsCount
in interface ArrayType
public void setElementsCount(int newLength)
ArrayType
setElementsCount
in interface ArrayType
newLength
- new array sizepublic Argument[] toArgumentsArray()
ArrayType
toArgumentsArray
in interface ArrayType
Argument[]
public void fromArgumentsArray(Argument[] arguments)
ArrayType
fromArgumentsArray
in interface ArrayType
arguments
- Argument[]
array ot the new valuesprotected void writeToStack(byte[] stack, int offset)
Argument
writeToStack
in class Argument
stack
- it's byte array, where Argument
will be writtenoffset
- offset in stackprotected void readFromStack(byte[] stack, int offset)
Argument
readFromStack
in class Argument
stack
- it's byte array, from which Argument
will be restoredoffset
- offset in stackpublic int getLength()
Argument
getLength
in class Argument
public byte[] toBytesValue()
Argument
toBytesValue
in class Argument
Argument
protected void toBytesValue(byte[] bytes, int offset)
Argument
toBytesValue
in class Argument
bytes
- array of bytes to which Argument
will be writtenoffset
- offset in arraypublic void fromBytesValue(byte[] bytes, int offset)
Argument
fromBytesValue
in class Argument
bytes
- array of bytes from which Argument
will be restoredoffset
- offset in arrayprotected void write(long handle, int offset) throws MemoryException
Argument
write
in class Argument
handle
- identifies location in memory where Argument
will be writtenoffset
- memory address offset
MemoryException
- if memory manipulations or memory access failedprotected void read(long handle, int offset) throws MemoryException
Argument
read
in class Argument
handle
- identifies location in memory from which Argument
will be readoffset
- memory address offset
MemoryException
- if memory manipulations or memory access failedprotected void update(byte side)
Argument
update
in class Argument
side
- identifies part that should be updatedprotected boolean isFixedLength()
Argument
Argument
is a fixed length variable.
isFixedLength
in class Argument
true
if it is so, and false
otherwise
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |