public class NativeTypeArray extends BaseNativeType
Modifier and Type | Field and Description |
---|---|
private BaseNativeType[] |
elements
Stores the contained elements for the array.
|
copyIn, copyOut, passByPointer, ptr, ref, type
Constructor and Description |
---|
NativeTypeArray()
Default constructor.
|
NativeTypeArray(BaseNativeType[] elements)
Constructor that takes a list of elements.
|
Modifier and Type | Method and Description |
---|---|
BaseNativeType[] |
getElements()
Access the array of data elements.
|
void |
readExternal(java.io.ObjectInput in)
Replacement for the default object reading method.
|
long |
render(long addr)
Render the data into native memory, which will be allocated if the address is not
given.
|
void |
restore(long addr)
Copy back (if necessary) data from the native memory and deallocate the memory
if this instance allocated it in the first place.
|
void |
setElements(BaseNativeType[] elements)
Assign the array of data elements.
|
int |
size()
Report the size (in bytes) of the native memory needed to store this instance.
|
void |
writeExternal(java.io.ObjectOutput out)
Replacement for the default object writing method.
|
isCopyIn, isCopyOut, isPassByPointer, render, restore, setCopyIn, setCopyOut, setPassByPointer, setType, type
private BaseNativeType[] elements
public NativeTypeArray()
public NativeTypeArray(BaseNativeType[] elements)
elements
- The elements for this array.public BaseNativeType[] getElements()
public void setElements(BaseNativeType[] elements)
elements
- The array of elements.public int size()
This should never be called on the server, only on the client side.
size
in class BaseNativeType
public long render(long addr)
This should never be called on the server, only on the client side.
Arrays are rendered as a pointer to a block of memory in which each element is written contiguously from lowest address to highest address and the size of the block is the number of elements multiplied by the size of each element (which must be the same for all elements). This is consistent with how native code ('C' language) handles arrays.
render
in class BaseNativeType
addr
- The memory address to which the data should be rendered, if the caller
is supplying a buffer or 0 if the buffer should be allocated.public void restore(long addr)
This should never be called on the server, only on the client side.
restore
in class BaseNativeType
addr
- The memory address from which the data should be restored, if the caller
is supplying a buffer or 0 if the buffer should already exist.public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
readExternal
in interface java.io.Externalizable
readExternal
in class BaseNativeType
in
- The input source from which fields will be restored.java.io.IOException
- In case of I/O errors.java.lang.ClassNotFoundException
- If payload can't be instantiated.public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
writeExternal
in class BaseNativeType
out
- The output destination to which fields will be saved.java.io.IOException
- In case of I/O errors.