ch.bind.philib.lang
| Modifier and Type | Field and Description |
|---|---|
static byte[] |
EMPTY_BYTE_ARRAY |
static char[] |
EMPTY_CHAR_ARRAY |
static double[] |
EMPTY_DOUBLE_ARRAY |
static float[] |
EMPTY_FLOAT_ARRAY |
static int[] |
EMPTY_INT_ARRAY |
static long[] |
EMPTY_LONG_ARRAY |
static short[] |
EMPTY_SHORT_ARRAY |
| Modifier | Constructor and Description |
|---|---|
protected |
ArrayUtil() |
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
append(byte[] a,
byte[] b,
int capacity)
append the content of two byte arrays up to a certain capacity limit
|
static <T> T[] |
append(Class<T> clazz,
T[] a,
T b) |
static byte[] |
concat(byte[] a,
byte[] b)
concatenate the content of two byte arrays.
|
static boolean |
contains(byte[] data,
byte[] search) |
static byte[] |
extractBack(byte[] data,
int len) |
static byte[] |
extractFront(byte[] data,
int len) |
static int |
find(byte[] data,
byte[] search) |
static int |
find(byte[] data,
byte[] search,
int dataOffset) |
static String |
formatShortHex(byte[] data) |
static String |
formatShortHex(byte[] data,
int off,
int len) |
static String |
formatShortHex(ByteBuffer data) |
static String |
formatShortHex(ByteBuffer data,
int len) |
static void |
memclr(byte[] buf)
Overwrites the buffer's content with zeros.
|
static void |
memclr(ByteBuffer buf)
Overwrites the buffer's content with zeros.
|
static <T> T[] |
newArray(Class<T> clazz,
int size)
shorthand for
java.lang.reflect.Array.newInstance(clazz, size) |
static <T> void |
pickRandom(T[] source,
T[] destination)
Fills the
destination array with randomly picked values from
the source array. |
static <T> T[] |
prepend(Class<T> clazz,
T[] a,
T b) |
static <T> T[] |
remove(Class<T> clazz,
T[] from,
T what) |
static <T> T[] |
toArray(Class<T> clazz,
Collection<? extends T> collection) |
public static final byte[] EMPTY_BYTE_ARRAY
public static final char[] EMPTY_CHAR_ARRAY
public static final short[] EMPTY_SHORT_ARRAY
public static final int[] EMPTY_INT_ARRAY
public static final long[] EMPTY_LONG_ARRAY
public static final float[] EMPTY_FLOAT_ARRAY
public static final double[] EMPTY_DOUBLE_ARRAY
public static <T> T[] newArray(Class<T> clazz, int size)
java.lang.reflect.Array.newInstance(clazz, size)clazz - -size - -public static <T> void pickRandom(T[] source,
T[] destination)
destination array with randomly picked values from
the source array. No value will be picked twice.source - The array from which random values must be picked. The
content of this array will not be altered.destination - The array which must be filled with random values.
Previous values within this array will be overwritten.NullPointerException - If either of the two parameters is null.IllegalArgumentException - If the source-array is smaller than the destination
-array.public static byte[] concat(byte[] a,
byte[] b)
a - the first byte array (may be null)b - the second byte array (may be null)a and b, containing a
copy of their content.public static byte[] append(byte[] a,
byte[] b,
int capacity)
a - the first byte array (may be null)b - the second byte array (may be null)a and b, containing a
copy of their content.
if the combined
length exceeds capacity the returned array a will
have a.length == capacity.public static <T> T[] prepend(Class<T> clazz, T[] a, T b)
public static <T> T[] append(Class<T> clazz, T[] a, T b)
public static <T> T[] remove(Class<T> clazz, T[] from, T what)
public static byte[] extractBack(byte[] data,
int len)
public static byte[] extractFront(byte[] data,
int len)
public static boolean contains(byte[] data,
byte[] search)
public static int find(byte[] data,
byte[] search)
public static int find(byte[] data,
byte[] search,
int dataOffset)
public static String formatShortHex(byte[] data)
public static String formatShortHex(byte[] data, int off, int len)
public static String formatShortHex(ByteBuffer data, int len)
public static String formatShortHex(ByteBuffer data)
public static void memclr(ByteBuffer buf)
buf - -public static void memclr(byte[] buf)
buf - -public static <T> T[] toArray(Class<T> clazz, Collection<? extends T> collection)
Copyright © 2014. All Rights Reserved.