java.lang.Object
com.pnfsoftware.jeb.util.primitives.Bytes

public class Bytes extends Object
Utility methods for byte.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    equals(byte[] array1, int pos1, byte[] array2, int pos2, int size)
     
    static int
    indexOf(byte[] array, byte[] target)
    Find the first occurrence of a sequence of bytes.
    static int
    indexOf(byte[] array, int from, byte[] target)
    Find the first occurrence of a sequence of bytes.
    static int
    indexOf(byte[] array, int from, int end, byte[] target, int targetFrom, int targetEnd, byte[] targetMask)
    Find the first occurrence of a sequence of bytes.
    static int
    lastIndexOf(byte[] array, byte[] target)
    Find the last occurrence of a sequence of bytes.
    static int
    lastIndexOf(byte[] array, int from, byte[] target)
    Find the last occurrence of a sequence of bytes.
    static int
    lastIndexOf(byte[] array, int from, byte[] target, byte[] targetMask)
    Find the last occurrence of a sequence of bytes.
    static String
    toUnsignedString(byte value)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Bytes

      public Bytes()
  • Method Details

    • toUnsignedString

      public static String toUnsignedString(byte value)
      Parameters:
      value -
      Returns:
    • indexOf

      public static int indexOf(byte[] array, byte[] target)
      Find the first occurrence of a sequence of bytes.
      Parameters:
      array - array to be searched
      target - bytes to be found
      Returns:
      index >= 0, or -1 if not found
    • indexOf

      public static int indexOf(byte[] array, int from, byte[] target)
      Find the first occurrence of a sequence of bytes.
      Parameters:
      array - array to be searched
      from - start index in array
      target - bytes to be found
      Returns:
      index >= `from`, or -1 if not found
    • indexOf

      public static int indexOf(byte[] array, int from, int end, byte[] target, int targetFrom, int targetEnd, byte[] targetMask)
      Find the first occurrence of a sequence of bytes.
      Parameters:
      array - array to be found
      from - start of search
      end - end of search (exclusive)
      target - bytes to be found
      targetFrom - actual first target byte in the target array
      targetEnd - actual end (exclusive) target byte in the target array
      targetMask - optional binary mask, must be the same length as the target if present
      Returns:
      index >= from and < end, or -1 if not found
    • lastIndexOf

      public static int lastIndexOf(byte[] array, byte[] target)
      Find the last occurrence of a sequence of bytes.
      Parameters:
      array -
      target -
      Returns:
      index >= 0, or -1 if not found
    • lastIndexOf

      public static int lastIndexOf(byte[] array, int from, byte[] target)
      Find the last occurrence of a sequence of bytes.
      Parameters:
      array -
      from -
      target -
      Returns:
      index <= from, or -1 if not found
    • lastIndexOf

      public static int lastIndexOf(byte[] array, int from, byte[] target, byte[] targetMask)
      Find the last occurrence of a sequence of bytes.
      Parameters:
      array -
      from -
      target -
      targetMask - optional binary mask, must be the same length as the target if present
      Returns:
      index <= from, or -1 if not found
    • equals

      public static boolean equals(byte[] array1, int pos1, byte[] array2, int pos2, int size)