02/28/2005
 

com.epicentric.common
Class ByteUtils

java.lang.Object
  |
  +--com.epicentric.common.ByteUtils

Deprecated. as of 4.5, to be removed in 8.0 or later. This class will be moved to the com.vignette.portal.util package.

public class ByteUtils
extends Object

A set of static methods to manipulate byte arrays.


Constructor Summary
ByteUtils()
          Deprecated.  
 
Method Summary
static String byteArrayToHexString(byte[] bytes)
          Deprecated. as of version 4.5, to be removed in 8.0 or later. Replaced with ByteUtils.byteArrayToHexString(byte[]).
static byte[] calcMD5(byte[] data, int len)
          Deprecated. as of version 4.5, to be removed in 8.0 or later. Replaced with DigestUtils.calcMD5(byte[], int).
static boolean equal(byte[] array1, byte[] array2)
          Deprecated. as of version 4.5, to be removed in 8.0 or later. Use: java.util.Arrays.equals(byte[] a, byte[] a2).
static byte[] hexStringToByteArray(String hex_string)
          Deprecated. as of version 4.5, to be removed in 8.0 or later. Replaced with ByteUtils.hexStringToByteArray(String).
static int indexOf(byte[] b, byte byte_value)
          Deprecated. as of version 4.5, to be removed in 8.0 or later. Use: java.util.Arrays.binarySearch(byte[] a, byte key).
static int indexOf(byte[] b, int len, byte byte_value)
          Deprecated. as of version 4.5, to be removed in 8.0 or later.
static int indexOf(byte[] b, int offset, int len, byte byte_value)
          Deprecated. as of version 4.5, to be removed in 8.0 or later.
static boolean isEmpty(byte[] array)
          Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement.
static int strip(byte[] b, byte byte_value)
          Deprecated. as of version 4.5, to be removed in 8.0 or later.
static int strip(byte[] b, int len, byte byte_value)
          Deprecated. as of version 4.5, to be removed in 8.0 or later.
static int strip(byte[] b, int offset, int len, byte byte_value)
          Deprecated. as of version 4.5, to be removed in 8.0 or later.
static byte[] trimCapacity(byte[] data, int len)
          Deprecated. as of version 4.5, to be removed in 8.0 or later.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ByteUtils

public ByteUtils()
Deprecated. 
Method Detail

byteArrayToHexString

public static String byteArrayToHexString(byte[] bytes)
Deprecated. as of version 4.5, to be removed in 8.0 or later. Replaced with ByteUtils.byteArrayToHexString(byte[]).

Converts a byte array into a string of hexadecimal characters. Used to store byte array values such as MD5 signatures into databases or cookies.
Parameters:
bytes - Byte array to convert
Returns:
Hexadecimal string

hexStringToByteArray

public static byte[] hexStringToByteArray(String hex_string)
Deprecated. as of version 4.5, to be removed in 8.0 or later. Replaced with ByteUtils.hexStringToByteArray(String).

Converts a string of hexadecimal characters into a byte array. Used to retrieve a byte array that has been stored as a hex string in a cookie or database.
Parameters:
hex_string - String containing valid hexadecimal characters
Returns:
Byte array

equal

public static boolean equal(byte[] array1,
                            byte[] array2)
Deprecated. as of version 4.5, to be removed in 8.0 or later. Use: java.util.Arrays.equals(byte[] a, byte[] a2).

Tests whether two byte arrays are equal
Parameters:
array1 - First byte array
array2 - Second byte array
Returns:
true if both arrays are empty or if each element in one array is equal to the same element in the other array

calcMD5

public static byte[] calcMD5(byte[] data,
                             int len)
Deprecated. as of version 4.5, to be removed in 8.0 or later. Replaced with DigestUtils.calcMD5(byte[], int).

Calculates the MD5 of a set of data
Parameters:
data - Byte array containing the data to use
len - Number of bytes in the array - must be less than the array length
Returns:
Byte array containing the MD5 value, or null if an exception occurred or the byte array is null

isEmpty

public static boolean isEmpty(byte[] array)
Deprecated. as of version 4.5, to be removed in 8.0 or later. No replacement.

Tests whether a byte array is null or of zero length
Parameters:
array - Byte array to test
Returns:
true if the byte array is null or of zero length

strip

public static int strip(byte[] b,
                        byte byte_value)
Deprecated. as of version 4.5, to be removed in 8.0 or later.

Removes all occurrences of a specified value from a byte array. Shifts the following elements to the left, copying the last element to the end of the array. Note that this method modifies the input array.
Parameters:
b - Byte array
byte_value - Value to be removed
Returns:
Number of elements remaining

strip

public static int strip(byte[] b,
                        int len,
                        byte byte_value)
Deprecated. as of version 4.5, to be removed in 8.0 or later.

Removes all occurrences of a specified value from a subset of a byte array, starting with the first element. Shifts the following elements to the left, copying the last element to the end of the array. Note that this method modifies the input array.
Parameters:
b - Byte array
len - Number of elements to search
byte_value - Value to be removed
Returns:
Number of elements remaining

strip

public static int strip(byte[] b,
                        int offset,
                        int len,
                        byte byte_value)
Deprecated. as of version 4.5, to be removed in 8.0 or later.

Removes all occurrences of a specified value from a subset of a byte array. Shifts the following elements to the left, copying the last element to the end of the array. Note that this method modifies the input array.
Parameters:
b - Byte array
offset - Starting element to be searched for the value
len - Number of elements to search
byte_value - Value to be removed
Returns:
Number of elements remaining in the subset

indexOf

public static int indexOf(byte[] b,
                          byte byte_value)
Deprecated. as of version 4.5, to be removed in 8.0 or later. Use: java.util.Arrays.binarySearch(byte[] a, byte key).

Locates the specified value within a byte array
Parameters:
b - Byte array
byte_value - Value to be located
Returns:
Index of the first occurrence of byte_value if found; otherwise, -1

indexOf

public static int indexOf(byte[] b,
                          int len,
                          byte byte_value)
Deprecated. as of version 4.5, to be removed in 8.0 or later.

Searches the specified number of elements of a byte array, starting with the first element, for a specified value
Parameters:
b - Byte array
len - Number of elements to search
byte_value - Value to search for
Returns:
Index of the first occurrence of byte_value if found; otherwise, -1

indexOf

public static int indexOf(byte[] b,
                          int offset,
                          int len,
                          byte byte_value)
Deprecated. as of version 4.5, to be removed in 8.0 or later.

Searches the specified elements of a byte array for the first occurrence of a specified value
Parameters:
b - Byte array
offset - Starting element for the search
len - Number of elements to search
byte_value - Value to search for
Returns:
Index of the first occurrence of byte_value if found; otherwise, -1

trimCapacity

public static byte[] trimCapacity(byte[] data,
                                  int len)
Deprecated. as of version 4.5, to be removed in 8.0 or later.

Removes elements from the end of a byte array to create a new array of a specified length. Modifies the input array: the return value and the input array are the same new array.
Parameters:
data - Byte array
len - Index of the last element to be included in the new array
Returns:
New array if the number of elements in the original array is greater than len; otherwise, the original array

02/28/2005
 

Copyright and Trademark Notices