| j2native |
| AnsiString |
| Argument |
| ArrayArgument |
| ArrayType |
| Bool |
| Callback |
| Char |
| Const |
| DelegatedArgument |
| DoubleFloat |
| FloatArgument |
| FloatType |
| Function |
| FunctionExecutionException |
| FunctionNotFoundException |
| IllegalMemoryAccessException |
| Int |
| Int16 |
| Int32 |
| Int64 |
| Int8 |
| IntegerArgument |
| IntegerType |
| J2NativeContext |
| Library |
| LibraryLoader |
| LibraryNotFoundException |
| MemoryException |
| NumericArgument |
| NumericType |
| OutOnly |
| Pointer |
| Pointer.Const |
| Pointer.OutOnly |
| Pointer.Void |
| PointerArgument |
| PointerType |
| SimpleFloat |
| StringType |
| StructuralArgument |
| Structure |
| TypedPointer |
| UInt |
| UInt16 |
| UInt32 |
| UInt8 |
| Union |
| WideChar |
| WideString |
| ZeroTerminatedString |
|  |
com.smardec.j2native
Class ArrayArgument
java.lang.Object
|
+--com.smardec.j2native.Argument
|
+--com.smardec.j2native.ArrayArgument
- All Implemented Interfaces:
- ArrayType, java.lang.Cloneable
- public class ArrayArgument
- extends Argument
- implements ArrayType
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
|
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 java.lang.Object |
| equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ArrayArgument
public ArrayArgument(java.lang.Class arrayType,
int arrayLength)
- Constructs an array of objects of a specified class and size. Constructor
does not fill newly constructed array with a values
(all elements a
null), so you have to do it
- Parameters:
- arrayType - class for items in the constructed array
- arrayLength - count of items in the constructed array
ArrayArgument
public ArrayArgument(Argument sample,
int arrayLength)
- Constructs an array object of specified length. Constructor does not fill
newly constructed array with a values (all elements a
null),
so you have to do it.
- Parameters:
- sample - a sample for items in the constructed array
- arrayLength - count of items in the constructed array
ArrayArgument
public ArrayArgument(Argument[] elements)
- Constructs an array object taking a specified
Argument array.
- Parameters:
- elements -
Argument[] array ot the new values
getElement
public Argument getElement(int index)
- Description copied from interface: ArrayType
- Returns an array item specified by an index.
- Specified by:
- getElement in interface ArrayType
- Parameters:
- index - index of a requested array item
- Returns:
Argument item
setElement
public void setElement(int index,
Argument argument)
throws java.lang.ArrayStoreException
- Description copied from interface: ArrayType
- Replaces an array item with the specified object.
- Specified by:
- setElement in interface ArrayType
- Parameters:
- index - index of an item to be replaced
- argument - object to be set as array item
- Throws:
- java.lang.ArrayStoreException
getElementsCount
public int getElementsCount()
- Description copied from interface: ArrayType
- Returns the number of elements in the array.
- Specified by:
- getElementsCount in interface ArrayType
- Returns:
- elements quantity
setElementsCount
public void setElementsCount(int newLength)
- Description copied from interface: ArrayType
- Resizes this array to a given size.
- Specified by:
- setElementsCount in interface ArrayType
- Parameters:
- newLength - new array size
toArgumentsArray
public Argument[] toArgumentsArray()
- Description copied from interface: ArrayType
- Returns items as Java array.
- Specified by:
- toArgumentsArray in interface ArrayType
- Returns:
Argument[]
fromArgumentsArray
public void fromArgumentsArray(Argument[] arguments)
- Description copied from interface: ArrayType
- Sets array contents to the given values.
- Specified by:
- fromArgumentsArray in interface ArrayType
- Parameters:
- arguments -
Argument[] array ot the new values
writeToStack
protected void writeToStack(byte[] stack,
int offset)
- Description copied from class: Argument
- Writes itself to stack.
- Specified by:
- writeToStack in class Argument
- Parameters:
- stack - it's byte array, where
Argument will be written- offset - offset in stack
readFromStack
protected void readFromStack(byte[] stack,
int offset)
- Description copied from class: Argument
- Read itself from stack.
- Specified by:
- readFromStack in class Argument
- Parameters:
- stack - it's byte array, from which
Argument will be restored- offset - offset in stack
getLength
public int getLength()
- Description copied from class: Argument
- Returns length in bytes.
- Specified by:
- getLength in class Argument
- Returns:
- an int
toBytesValue
public byte[] toBytesValue()
- Description copied from class: Argument
- Encodes itself and returns it's representation as array of bytes.
- Specified by:
- toBytesValue in class Argument
- Returns:
- byte[] representation of
Argument
toBytesValue
protected void toBytesValue(byte[] bytes,
int offset)
- Description copied from class: Argument
- Encodes itself to the provided array of bytes.
- Specified by:
- toBytesValue in class Argument
- Parameters:
- bytes - array of bytes to which
Argument will be written- offset - offset in array
fromBytesValue
public void fromBytesValue(byte[] bytes,
int offset)
- Description copied from class: Argument
- Restores itself from provided array of bytes.
- Specified by:
- fromBytesValue in class Argument
- Parameters:
- bytes - array of bytes from which
Argument will be restored- offset - offset in array
write
protected void write(long handle,
int offset)
throws MemoryException
- Description copied from class: Argument
- Writes itself to the memory. Exact memory address specified by params.
- Specified by:
- write in class Argument
- Parameters:
- handle - identifies location in memory where
Argument
will be written- offset - memory address offset
- Throws:
- MemoryException - if memory manipulations or memory access failed
read
protected void read(long handle,
int offset)
throws MemoryException
- Description copied from class: Argument
- Reads itself from the memory. Exact memory address specified by params.
- Specified by:
- read in class Argument
- Parameters:
- handle - identifies location in memory from which
Argument
will be read- offset - memory address offset
- Throws:
- MemoryException - if memory manipulations or memory access failed
update
protected void update(byte side)
- Description copied from class: Argument
- This method is used to synchronize Java side and native part.
- Overrides:
- update in class Argument
- Parameters:
- side - identifies part that should be updated
isFixedLength
protected boolean isFixedLength()
- Description copied from class: Argument
- Identify if
Argument is a fixed length variable.
- Specified by:
- isFixedLength in class Argument
- Returns:
true if it is so, and false otherwise
|
|
|