public class ResourceArray extends Object
ResourceBuffer
. It holds a set of
data.
The data size in bytes is the same for all elements (aligned on bigger
encoded element). Each element data is aligned in memory on element size: 4
bytes for 32-bits values and 2 bytes for 16-bits values. The
ResourceBuffer
encoder ensures the array is aligned too (using the
same rule).
Modifier and Type | Method and Description |
---|---|
int |
elementAt(int index)
Reads the element at given index.
|
int[] |
elements()
Reads all array elements.
|
ResourceBuffer |
getBuffer()
Returns the
ResourceBuffer used to create the ResourceArray . |
int |
length()
Gets the number of elements contained in the array (not the size in bytes).
|
ResourceBuffer |
seekToElementPointer(int index)
Modify the position of the
ResourceBuffer used to create this
ResourceArray . |
public int elementAt(int index) throws IOException
index
- the element indexIOException
- if an I/O error occurs.IndexOutOfBoundsException
- when the index is negative or higher or equal than
length()
.public int[] elements() throws IOException
IOException
- if an I/O error occurs.public ResourceBuffer getBuffer()
ResourceBuffer
used to create the ResourceArray
.ResourceBuffer
public int length()
public ResourceBuffer seekToElementPointer(int index) throws IOException
ResourceBuffer
used to create this
ResourceArray
. Updates its position to point on the element defined
at the given index.index
- the ResourceBuffer
offset pointerResourceBuffer
used to create the ResourceArray
.IOException
- if an I/O error occurs.IndexOutOfBoundsException
- when the index is negative or higher or equal than
length()
.