Class ByteUtils


  • public final class ByteUtils
    extends Object
    A utility class for working with bytes.
    • Method Detail

      • asList

        public static List<Byte> asList​(byte[] aByteArray)
        Returns a byte array as a list of bytes.
        Parameters:
        aByteArray - An array of bytes
        Returns:
        A list of bytes
      • asArray

        public static byte[] asArray​(List<Byte> aByteList)
        Returns a list of bytes as an array or bytes.
        Parameters:
        aByteList - A list of bytes
        Returns:
        An array of bytes
      • reverse

        public static void reverse​(byte[] aArray)
        Reverses the elements of array. This is equivalent to Collections.reverse(Bytes.asList(array)), but is likely to be more efficient.
        Parameters:
        aArray - An array of bytes
      • reverse

        public static void reverse​(byte[] aByteArray,
                                   int aStart,
                                   int aEnd)
        Reverses the elements of the array.
        Parameters:
        aByteArray - An array of bytes
        aStart - A start position
        aEnd - A end position
        Throws:
        IndexOutOfBoundsException - If the start or end are out of range of the array