All Packages Class Hierarchy This Package Previous Next Index
Class com.ibm.eou.toolkit.util.ArrayUtils
java.lang.Object
|
+----com.ibm.eou.toolkit.util.ArrayUtils
- public class ArrayUtils
- extends Object
This class provides array utility functions.
-
DIFFERENCE
- Constant representing the difference between two arrays.
-
INTERSECTION
- Constant representing the intersection between two arrays.
-
SYMMETRIC_DIFFERENCE
- Constant representing the symmetric difference between two
arrays.
-
UNION
- Constant representing the union between two arrays.
-
addElement(Object, Object[], Object[])
- Add the specified object to the end of the source array.
-
combine(char[], char[], int)
- Return an array which is the result of the specified operation
upon the two given arrays.
-
compressArray(byte[], int)
- Compress the array by creating an index of distinct multi-byte values
with the given size, which must divide the array length exactly.
-
copy(char[], int, char[], int, char[], boolean)
- Copy elements from the source array to the target array, beginning
at the specified positions in each array.
-
deflate(byte[], int)
- Deflate the byte array using the specified compression of the Deflater class.
-
expandArray(byte[])
- Recover the original array from the specified compressedArray
as obtained from the compressArray method.
-
indexOf(boolean[], boolean)
- Return the index of the first element in the array
which equals the given search value, or -1 if the
search value is not found or if the array is null.
-
indexOf(boolean[], boolean, int)
- Return the index of the first element in the array
whose index is greater than or equal to the given starting index
and which equals the given search value, or -1 if the
search value is not found or if the array is null.
-
indexOf(byte[], byte)
- Return the index of the first element in the array
which equals the given search value, or -1 if the
search value is not found or if the array is null.
-
indexOf(byte[], byte, int)
- Return the index of the first element in the array
whose index is greater than or equal to the given starting index
and which equals the given search value, or -1 if the
search value is not found or if the array is null.
-
indexOf(char[], char)
- Return the index of the first element in the array
which equals the given search value, or -1 if the
search value is not found or if the array is null.
-
indexOf(char[], char, int)
- Return the index of the first element in the array
whose index is greater than or equal to the given starting index
and which equals the given search value, or -1 if the
search value is not found or if the array is null.
-
indexOf(double[], double)
- Return the index of the first element in the array
which equals the given search value, or -1 if the
search value is not found or if the array is null.
-
indexOf(double[], double, int)
- Return the index of the first element in the array
whose index is greater than or equal to the given starting index
and which equals the given search value, or -1 if the
search value is not found or if the array is null.
-
indexOf(float[], float)
- Return the index of the first element in the array
which equals the given search value, or -1 if the
search value is not found or if the array is null.
-
indexOf(float[], float, int)
- Return the index of the first element in the array
whose index is greater than or equal to the given starting index
and which equals the given search value, or -1 if the
search value is not found or if the array is null.
-
indexOf(int[], int)
- Return the index of the first element in the array
which equals the given search value, or -1 if the
search value is not found or if the array is null.
-
indexOf(int[], int, int)
- Return the index of the first element in the array
whose index is greater than or equal to the given starting index
and which equals the given search value, or -1 if the
search value is not found or if the array is null.
-
indexOf(long[], long)
- Return the index of the first element in the array
which equals the given search value, or -1 if the
search value is not found or if the array is null.
-
indexOf(long[], long, int)
- Return the index of the first element in the array
whose index is greater than or equal to the given starting index
and which equals the given search value, or -1 if the
search value is not found or if the array is null.
-
indexOf(Object[], Object)
- Return the index of the first element in the array
which equals the given search value, or -1 if the
search value is not found or if the array is null.
-
indexOf(Object[], Object, boolean)
- Return the index of the first element in the array
which equals the given search value, or -1 if the
search value is not found or if the array is null.
-
indexOf(Object[], Object, int)
- Return the index of the first element in the array
whose index is greater than or equal to the given starting index
and which equals the given search value, or -1 if the
search value is not found or if the array is null.
-
indexOf(Object[], Object, int, boolean)
- Return the index of the first element in the array
whose index is greater than or equal to the given starting index
and which equals the given search value, or -1 if the
search value is not found or if the array is null.
-
indexOf(short[], short)
- Return the index of the first element in the array
which equals the given search value, or -1 if the
search value is not found or if the array is null.
-
indexOf(short[], short, int)
- Return the index of the first element in the array
whose index is greater than or equal to the given starting index
and which equals the given search value, or -1 if the
search value is not found or if the array is null.
-
inflate(byte[])
- Inflate the byte array using the Inflater class.
-
readAsInt(byte[], int, int)
- Read the specified number of bytes from the byte array as an int,
and return the int read.
-
removeElement(Object, Object[], Object[])
- Remove the supplied object from the source array.
-
writeAsBytes(byte[], int, int, int)
- Write an int as the specified number of bytes into the byte array,
and return that number of bytes.
DIFFERENCE
public static final int DIFFERENCE
- Constant representing the difference between two arrays.
This consists of all the items which are elements of the
first array and not elements of the second array.
UNION
public static final int UNION
- Constant representing the union between two arrays.
This consists of all the items which are elements of the
first array or elements of the second array.
INTERSECTION
public static final int INTERSECTION
- Constant representing the intersection between two arrays.
This consists of all the items which are elements of both
arrays.
SYMMETRIC_DIFFERENCE
public static final int SYMMETRIC_DIFFERENCE
- Constant representing the symmetric difference between two
arrays. This consists of all the items which are elements
of the first array only, or elements which are of the second
array only.
combine
public static char[] combine(char array1[],
char array2[],
int operation)
- Return an array which is the result of the specified operation
upon the two given arrays. The operation can be DIFFERENCE,
UNION, INTERSECTION, or SYMMETRIC_DIFFERENCE. The result is
undefined if either of the given arrays contain any elements
more than once.
- See Also:
- DIFFERENCE, UNION, INTERSECTION, SYMMETRIC_DIFFERENCE
copy
public static int copy(char source[],
int sourcePosition,
char target[],
int targetPosition,
char match[],
boolean excludeMatching)
- Copy elements from the source array to the target array, beginning
at the specified positions in each array. Only elements which are
also found in the match array are copied, unless excludeMatching
is true in which case only elements which do not match are
copied. The number of elements which were copied is returned.
compressArray
public static byte[] compressArray(byte source[],
int gulpSize)
- Compress the array by creating an index of distinct multi-byte values
with the given size, which must divide the array length exactly.
The returned array includes the index and the indexed entries,
and the original array can be recovered by passing the returned
array to the expandArray() method.
- See Also:
- expandArray
writeAsBytes
public static int writeAsBytes(byte target[],
int targetIndex,
int bytesToWrite,
int intToWrite)
- Write an int as the specified number of bytes into the byte array,
and return that number of bytes.
The int is written low byte first, high byte last.
readAsInt
public static int readAsInt(byte source[],
int sourceIndex,
int bytesToRead)
- Read the specified number of bytes from the byte array as an int,
and return the int read.
The int is read as low byte first, high byte last.
expandArray
public static byte[] expandArray(byte compressedArray[])
- Recover the original array from the specified compressedArray
as obtained from the compressArray method.
- See Also:
- compressArray
deflate
public static byte[] deflate(byte source[],
int compression)
- Deflate the byte array using the specified compression of the Deflater class.
inflate
public static byte[] inflate(byte source[]) throws DataFormatException
- Inflate the byte array using the Inflater class.
- Throws: DataFormatException
- thrown if the data is not valid zip data.
indexOf
public static int indexOf(Object array[],
Object searchValue)
- Return the index of the first element in the array
which equals the given search value, or -1 if the
search value is not found or if the array is null.
The == operator is used to test equality.
indexOf
public static int indexOf(Object array[],
Object searchValue,
int startIndex)
- Return the index of the first element in the array
whose index is greater than or equal to the given starting index
and which equals the given search value, or -1 if the
search value is not found or if the array is null.
The == operator is used to test equality.
indexOf
public static int indexOf(Object array[],
Object searchValue,
boolean useEqualsMethod)
- Return the index of the first element in the array
which equals the given search value, or -1 if the
search value is not found or if the array is null.
If useEqualsMethod is true, the equals() method is used
to test equality. Otherwise, the == operator is used.
indexOf
public static int indexOf(Object array[],
Object searchValue,
int startIndex,
boolean useEqualsMethod)
- Return the index of the first element in the array
whose index is greater than or equal to the given starting index
and which equals the given search value, or -1 if the
search value is not found or if the array is null.
If useEqualsMethod is true, the equals() method is used
to test equality. Otherwise, the == operator is used.
indexOf
public static long indexOf(long array[],
long searchValue)
- Return the index of the first element in the array
which equals the given search value, or -1 if the
search value is not found or if the array is null.
indexOf
public static int indexOf(long array[],
long searchValue,
int startIndex)
- Return the index of the first element in the array
whose index is greater than or equal to the given starting index
and which equals the given search value, or -1 if the
search value is not found or if the array is null.
indexOf
public static int indexOf(int array[],
int searchValue)
- Return the index of the first element in the array
which equals the given search value, or -1 if the
search value is not found or if the array is null.
indexOf
public static int indexOf(int array[],
int searchValue,
int startIndex)
- Return the index of the first element in the array
whose index is greater than or equal to the given starting index
and which equals the given search value, or -1 if the
search value is not found or if the array is null.
indexOf
public static int indexOf(short array[],
short searchValue)
- Return the index of the first element in the array
which equals the given search value, or -1 if the
search value is not found or if the array is null.
indexOf
public static int indexOf(short array[],
short searchValue,
int startIndex)
- Return the index of the first element in the array
whose index is greater than or equal to the given starting index
and which equals the given search value, or -1 if the
search value is not found or if the array is null.
indexOf
public static int indexOf(char array[],
char searchValue)
- Return the index of the first element in the array
which equals the given search value, or -1 if the
search value is not found or if the array is null.
indexOf
public static int indexOf(char array[],
char searchValue,
int startIndex)
- Return the index of the first element in the array
whose index is greater than or equal to the given starting index
and which equals the given search value, or -1 if the
search value is not found or if the array is null.
indexOf
public static int indexOf(byte array[],
byte searchValue)
- Return the index of the first element in the array
which equals the given search value, or -1 if the
search value is not found or if the array is null.
indexOf
public static int indexOf(byte array[],
byte searchValue,
int startIndex)
- Return the index of the first element in the array
whose index is greater than or equal to the given starting index
and which equals the given search value, or -1 if the
search value is not found or if the array is null.
indexOf
public static int indexOf(boolean array[],
boolean searchValue)
- Return the index of the first element in the array
which equals the given search value, or -1 if the
search value is not found or if the array is null.
indexOf
public static int indexOf(boolean array[],
boolean searchValue,
int startIndex)
- Return the index of the first element in the array
whose index is greater than or equal to the given starting index
and which equals the given search value, or -1 if the
search value is not found or if the array is null.
indexOf
public static int indexOf(float array[],
float searchValue)
- Return the index of the first element in the array
which equals the given search value, or -1 if the
search value is not found or if the array is null.
indexOf
public static int indexOf(float array[],
float searchValue,
int startIndex)
- Return the index of the first element in the array
whose index is greater than or equal to the given starting index
and which equals the given search value, or -1 if the
search value is not found or if the array is null.
indexOf
public static int indexOf(double array[],
double searchValue)
- Return the index of the first element in the array
which equals the given search value, or -1 if the
search value is not found or if the array is null.
indexOf
public static int indexOf(double array[],
double searchValue,
int startIndex)
- Return the index of the first element in the array
whose index is greater than or equal to the given starting index
and which equals the given search value, or -1 if the
search value is not found or if the array is null.
addElement
public static Object[] addElement(Object object,
Object sourceArray[],
Object destinationArray[])
- Add the specified object to the end of the source array.
The destination array should be of the same type as the
source array and have one more element.
removeElement
public static Object[] removeElement(Object object,
Object sourceArray[],
Object destinationArray[])
- Remove the supplied object from the source array.
If the object is not found in the array the original
array is returned. If the object is found it is removed
from the array and a new array is created one element
smaller than the source array with all elements of a
higher index than the removed element moving down the
array. The destination array should be of the same type as
the source array and have one less element.
All Packages Class Hierarchy This Package Previous Next Index