public class ByteArrayUtil extends Object
| Constructor and Description | 
|---|
| ByteArrayUtil() | 
| Modifier and Type | Method and Description | 
|---|---|
| static int | compareRegion(byte[] array1,
             int startIdx1,
             byte[] array2,
             int startIdx2,
             int length)Compares two regions of bytes, indicating whether one is larger than the other. | 
| static int | find(byte[] a,
    int fromIndex,
    int toIndex,
    byte key)Retrieve a byte from a byte array. | 
| static int | find(byte[] a,
    int fromIndex,
    int toIndex,
    byte[] key)Look for a sequence of bytes in a byte array. | 
| static byte[] | get(byte[] array,
   int offset)Gets the subarray from array that starts at offset. | 
| static byte[] | get(byte[] array,
   int offset,
   int length)Gets the subarray of length length from array that starts at offset. | 
| static int | getInt(byte[] array,
      int offset)Get an integer value from a byte array at a specific offset. | 
| static long | getLong(byte[] array,
       int offset)Get a long value from a byte array at a specific offset. | 
| static boolean | matchesPattern(byte[] value,
              byte[] mask,
              byte[] pattern)Checks whether value matches pattern with respect to the bits specified by mask. | 
| static void | put(byte[] source,
   byte[] target,
   int offset)Puts the entire source array in the target array at offset offset. | 
| static void | putInt(int value,
      byte[] array,
      int offset)Put an integer value (padded) in a byte array at a specific offset. | 
| static void | putLong(long value,
       byte[] array,
       int offset)Put a long value (padded) in a byte array at a specific offset. | 
| static boolean | regionMatches(byte[] subValue,
             byte[] superValue,
             int offset)Checks whether subValue matches the region in superValue starting at offset offset. | 
| static BitSet | toBitSet(byte[] array)Convert a byte array to a vector of bits. | 
| static byte[] | toByteArray(BitSet bitSet)Convert a bitset to a byte array. | 
| static String | toHexString(byte[] array)Returns the hexadecimal value of the supplied byte array. | 
public static void put(byte[] source,
                       byte[] target,
                       int offset)
source - source arraytarget - target arrayoffset - non-negative offsetpublic static byte[] get(byte[] array,
                         int offset)
array - source arrayoffset - non-negative offsetpublic static byte[] get(byte[] array,
                         int offset,
                         int length)
array - byte arrayoffset - non-negative offsetlength - lengthpublic static void putInt(int value,
                          byte[] array,
                          int offset)
value - integer valuearray - byte arrayoffset - non-negative offsetpublic static int getInt(byte[] array,
                         int offset)
array - byte arrayoffset - non-negative offsetpublic static void putLong(long value,
                           byte[] array,
                           int offset)
value - long valuearray - byte arrayoffset - non-negative offsetpublic static long getLong(byte[] array,
                           int offset)
array - byte arrayoffset - offsetpublic static int find(byte[] a,
                       int fromIndex,
                       int toIndex,
                       byte key)
a - the byte array to look infromIndex - the position from which to start lookingtoIndex - the position up to which to lookkey - the byte to findpublic static int find(byte[] a,
                       int fromIndex,
                       int toIndex,
                       byte[] key)
a - the byte array to look infromIndex - the position from which to start lookingtoIndex - the position up to which to lookkey - the bytes to findpublic static boolean matchesPattern(byte[] value,
                                     byte[] mask,
                                     byte[] pattern)
value - byte arraymask - pattern - patternpublic static boolean regionMatches(byte[] subValue,
                                    byte[] superValue,
                                    int offset)
subValue - value to search forsuperValue - byte arrayoffset - non-negative offsetpublic static int compareRegion(byte[] array1,
                                int startIdx1,
                                byte[] array2,
                                int startIdx2,
                                int length)
array1 - The first byte array.startIdx1 - The start of the region in the first array.array2 - The second byte array.startIdx2 - The start of the region in the second array.length - The length of the region that should be compared.public static BitSet toBitSet(byte[] array)
array - byte arraypublic static byte[] toByteArray(BitSet bitSet)
bitSet - bitset (should not be null)public static String toHexString(byte[] array)
array - byte arrayCopyright © 2015-2020 Eclipse Foundation. All Rights Reserved.