com.ibm.ws.security.util

Class ByteArray

  • java.lang.Object
    • com.ibm.ws.security.util.ByteArray
  • All Implemented Interfaces:
    java.io.Serializable


    public class ByteArray
    extends java.lang.Object
    implements java.io.Serializable

    This module is a utility class to work with byte arrays. It performs initialization, copies and compares byte arrays.

    Since:
    1.0
    Version:
    1.0
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor and Description
      ByteArray(byte[] barray)
      Default constructor Returns a ByteArray given a byte[]
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      static boolean compare(byte[] a, byte[] b)
      The compare method compares the byte arrays for equality.
      static void copy(byte[] from, int offsetFrom, int len, byte[] to, int offsetTo)
      The copy method copies data of length len from the array from to the array to, from the offset offsetFrom to the offset offsetTo.
      boolean equals(java.lang.Object arrayObj)
      The equals method determines if the array object passed in is equal to another array.
      byte[] getArray()
      The getArray method returns a byte array of type byte [].
      int hashCode()
      The hashCode method determines the hash of an array.
      static void initialize(byte[] array, byte val)
      The initialize method initializes the array to a given value.
      void setArray(byte[] array)
      The setArray method sets the byte array of type byte[].
      static byte[] XOR(byte[] a, byte b)
      The XOR method performs the xor function of two byte arrays.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ByteArray

        public ByteArray(byte[] barray)

        Default constructor

        Returns a ByteArray given a byte[]
        Parameters:
        the - array to convert into ByteArray
    • Method Detail

      • getArray

        public byte[] getArray()

        The getArray method returns a byte array of type byte [].

        Returns:
        the byte[]
      • setArray

        public void setArray(byte[] array)

        The setArray method sets the byte array of type byte[].

        Parameters:
        the - byte[] array
      • equals

        public boolean equals(java.lang.Object arrayObj)

        The equals method determines if the array object passed in is equal to another array.

        Overrides:
        equals in class java.lang.Object
        Parameters:
        the - array object
        Returns:
        true if the two arrays are equal
      • hashCode

        public int hashCode()

        The hashCode method determines the hash of an array.

        Overrides:
        hashCode in class java.lang.Object
        Returns:
        the hash
      • initialize

        public static void initialize(byte[] array,
                      byte val)

        The initialize method initializes the array to a given value.

        Parameters:
        the - array to initialize
        the - value
      • copy

        public static void copy(byte[] from,
                int offsetFrom,
                int len,
                byte[] to,
                int offsetTo)

        The copy method copies data of length len from the array from to the array to, from the offset offsetFrom to the offset offsetTo.

        Parameters:
        the - input array
        the - offset for the input array
        the - length to copy
        the - output array
        the - offset for the output array
      • compare

        public static boolean compare(byte[] a,
                      byte[] b)
        The compare method compares the byte arrays for equality.
        Parameters:
        first - byte array
        second - byte array
        Returns:
        true if the byte arrays are equal
      • XOR

        public static byte[] XOR(byte[] a,
                 byte b)
        The XOR method performs the xor function of two byte arrays.
        Parameters:
        first - byte array
        second - byte array
        Returns:
        the resulting byte array
IBM WebSphere Application ServerTM
Release 8.5