public class PrimitiveArray extends Parameter implements ArrayParameter, AlignmentAwareParameter
LICENSE_TYPE, V
Constructor and Description |
---|
PrimitiveArray(byte[] data)
Constructs a byte array and fills it with specified data.
|
PrimitiveArray(byte[] buf,
java.lang.Class entriesClass)
Constructs an array of objects of a specified class and fills it with
corresponding data.
|
PrimitiveArray(java.lang.Class entriesClass,
int count)
Constructs an array and fills it with instances of a specified class.
|
PrimitiveArray(Parameter[] params)
Constructs an array object taking a specified
Parameter
array. |
PrimitiveArray(Parameter sample,
int count)
Constructs an array object.
|
PrimitiveArray(PrimitiveArray t)
Constructs a copy of a specified array.
|
Modifier and Type | Method and Description |
---|---|
protected Parameter |
asReturnValue()
Returns a parameter that represents this one as a return value.
|
java.lang.Object |
clone() |
void |
forceElementCount(int elementCount)
Sets a new array size without memory reallocation.
|
void |
fromParameterArray(Parameter[] params)
Sets array contents to the given values.
|
protected int |
getAlignedLength()
Returns a parameter length in bytes aligned to default alignment.
|
int |
getAlignmentRequirement() |
byte[] |
getBytes()
Returns byte data of an array.
|
java.lang.String |
getDebugInfo()
Return debug info for JNIWrapper parameter.
|
Parameter |
getElement(int i)
Returns an array item specified by an index.
|
int |
getElementCount()
Returns the number of elements in the array.
|
java.lang.Class |
getEntryClass()
Returns a class of array items.
|
int |
getFirstMemberSize()
Should return first member size.
|
int |
getLength()
Returns the length of the array data in bytes.
|
void |
read(DataBuffer stackBuffer,
int offset,
boolean invokedByCallback)
Reads this parameter from a specified data source.
|
void |
readPartially(byte[] arr,
int offset)
Reads raw data from a given array into this object's data source.
|
void |
resizeAndRead(byte[] arr,
int offset,
int dataLength)
Sets a new size of this array and reads it from a given byte array.
|
void |
setElement(int i,
Parameter elem)
Replaces an array item with the specified object.
|
void |
setElementCount(int elementCount)
Resizes this array to a given size.
|
Parameter[] |
toParameterArray()
Returns items as Java array.
|
void |
write(DataBuffer stackBuffer,
int offset,
boolean invokedByCallback)
Writes this parameter to a specified data source.
|
acceptIOPerformer, dataBufferAssigned, equals, getDataBuffer, getDataBufferOffset, hashCode, indent, pop, push, read, read, setDataBuffer, toByteArray, write
public PrimitiveArray(PrimitiveArray t)
public PrimitiveArray(java.lang.Class entriesClass, int count)
entriesClass
- Class of array itemscount
- Count of array itemspublic PrimitiveArray(byte[] data)
public PrimitiveArray(Parameter sample, int count)
sample
- a sample for items in the constructed array.count
- count of items in the constructed array.public PrimitiveArray(byte[] buf, java.lang.Class entriesClass)
public PrimitiveArray(Parameter[] params)
Parameter
array.public java.lang.Class getEntryClass()
public int getLength()
public byte[] getBytes()
public java.lang.String getDebugInfo()
Parameter
getDebugInfo
in class Parameter
public Parameter getElement(int i)
ArrayParameter
getElement
in interface ArrayParameter
i
- index of a requested array itempublic void setElement(int i, Parameter elem)
ArrayParameter
setElement
in interface ArrayParameter
i
- index of an item to be replacedelem
- object to be set as array itempublic int getElementCount()
ArrayParameter
getElementCount
in interface ArrayParameter
public Parameter[] toParameterArray()
ArrayParameter
toParameterArray
in interface ArrayParameter
public void fromParameterArray(Parameter[] params)
ArrayParameter
fromParameterArray
in interface ArrayParameter
public void write(DataBuffer stackBuffer, int offset, boolean invokedByCallback) throws MemoryAccessViolationException
Parameter
write
in class Parameter
MemoryAccessViolationException
public void read(DataBuffer stackBuffer, int offset, boolean invokedByCallback) throws MemoryAccessViolationException
Parameter
read
in class Parameter
MemoryAccessViolationException
public void readPartially(byte[] arr, int offset)
read(byte[] arr, int offset)
, where data beyond a
given array length in the source array is unspecified.public void resizeAndRead(byte[] arr, int offset, int dataLength)
arr
- new array raw (as in memory) content.offset
- where this parameter starts in arr
dataLength
- raw length of this array (sizeof(element) *
elementCount)public void forceElementCount(int elementCount)
ArrayParameter
forceElementCount
in interface ArrayParameter
public void setElementCount(int elementCount)
ArrayParameter
setElementCount
in interface ArrayParameter
protected int getAlignedLength()
Parameter
getAlignedLength
in class Parameter
public int getAlignmentRequirement()
getAlignmentRequirement
in class Parameter
protected Parameter asReturnValue()
Parameter
asReturnValue
in class Parameter
this
public int getFirstMemberSize()
AlignmentAwareParameter
getFirstMemberSize
in interface AlignmentAwareParameter