|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.dalsemi.system.ArrayUtils
This class implements methods to manage arrays. This includes comparison, copying, filling and inserting and removing simple data types into byte arrays. Simple data types are stored in byte arrays in big-endian format.
Method Summary | |
static boolean |
arrayComp(Object array1,
int offset1,
Object arayr2,
int offset2,
int length)
Compares length elements in array1 at
offset1 with the elements in array2
at offset2 . |
static int |
arraycopy(Object src,
int src_position,
Object dst,
int dst_position,
int length)
Copies length elements from the src array
at index src_position to the dst array
at index dst_position . |
static void |
arrayCopyUnequal(Object fromArray,
int fromOffset,
Object toArray,
int toOffset,
int length)
Copies length common lower element bytes from
fromArray at fromOffset into
toArray at toOffset . |
static void |
arrayFill(byte[] thisArray,
int fromIndex,
int toIndex,
byte fillValue)
Fills thisArray from fromIndex to
toIndex with fillValue . |
static int |
getInt(byte[] thisArray,
int offset)
Reads an int value from a byte array. |
static long |
getLong(byte[] thisArray,
int offset)
Reads a long value from a byte array. |
static short |
getShort(byte[] thisArray,
int offset)
Reads a short value from a byte array. |
static byte[] |
setInt(byte[] thisArray,
int offset,
int value)
Writes an int value value to byte array
thisArray starting at offset offset . |
static byte[] |
setLong(byte[] thisArray,
int offset,
long value)
Writes a long value value to byte array
thisArray starting at offset offset . |
static byte[] |
setShort(byte[] thisArray,
int offset,
short value)
Writes a short value value to byte array
thisArray starting at offset offset . |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Method Detail |
public static int arraycopy(Object src, int src_position, Object dst, int dst_position, int length)
length
elements from the src
array
at index src_position
to the dst
array
at index dst_position
. The src
and
dst
arrays must be of the same type. This is similar to
java.lang.System.arraycopy()
, but more restrictive.
This allows it to be slightly faster, and calls one less method than
the same array copy performed through the java.lang.System
class.src
- source arraysrc_position
- starting index in source arraydst
- target arraydst_position
- starting index in target arraylength
- number of elements to copydst
and src
are arrays of references, and are not the same type, returns -1.public static void arrayCopyUnequal(Object fromArray, int fromOffset, Object toArray, int toOffset, int length)
length
common lower element bytes from
fromArray
at fromOffset
into
toArray
at toOffset
. fromArray
- source arrayfromIndex
- starting index in source arraytoArray
- target arraytoIndex
- starting index in target arraylength
- number of elements to copypublic static boolean arrayComp(Object array1, int offset1, Object arayr2, int offset2, int length)
length
elements in array1
at
offset1
with the elements in array2
at offset2
.array1
- source arrayoffset1
- starting index in source arrayarray2
- target arrayoffset2
- starting index in target arraylength
- number of elements to comparepublic static void arrayFill(byte[] thisArray, int fromIndex, int toIndex, byte fillValue)
thisArray
from fromIndex
to
toIndex
with fillValue
.thisArray
- target arrayfromIndex
- starting index for filltoIndex
- ending index for fillfillValue
- value to fill arraypublic static byte[] setShort(byte[] thisArray, int offset, short value)
value
to byte array
thisArray
starting at offset offset
. The values
are stored in the array in Big Endian form.thisArray
- array that will be modifiedoffset
- starting offsetvalue
- value to be writtenthisArray
public static byte[] setInt(byte[] thisArray, int offset, int value)
value
to byte array
thisArray
starting at offset offset
. The values
are stored in the array in Big Endian form.thisArray
- array that will be modifiedoffset
- starting offsetvalue
- value to be writtenthisArray
public static byte[] setLong(byte[] thisArray, int offset, long value)
value
to byte array
thisArray
starting at offset offset
. The values
are stored in the array in Big Endian form.thisArray
- array that will be modifiedoffset
- starting offsetvalue
- value to be writtenthisArray
public static short getShort(byte[] thisArray, int offset)
thisArray
- array containing the valueoffset
- starting offsetpublic static int getInt(byte[] thisArray, int offset)
thisArray
- array containing the valueoffset
- starting offsetpublic static long getLong(byte[] thisArray, int offset)
thisArray
- array containing the valueoffset
- starting offset
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |