Class Bytes
java.lang.Object
com.pnfsoftware.jeb.util.primitives.Bytes
Utility methods for
byte.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanequals(byte[] array1, byte[] array2) static booleanequals(byte[] array1, int pos1, byte[] array2, int pos2, int size) static intindexOf(byte[] array, byte[] target) Find the first occurrence of a sequence of bytes.static intindexOf(byte[] array, int from, byte[] target) Find the first occurrence of a sequence of bytes.static intindexOf(byte[] array, int from, int end, byte[] target, int targetFrom, int targetEnd, byte[] targetMask) Find the first occurrence of a sequence of bytes.static intlastIndexOf(byte[] array, byte[] target) Find the last occurrence of a sequence of bytes.static intlastIndexOf(byte[] array, int from, byte[] target) Find the last occurrence of a sequence of bytes.static intlastIndexOf(byte[] array, int from, byte[] target, byte[] targetMask) Find the last occurrence of a sequence of bytes.static StringtoUnsignedString(byte value)
-
Constructor Details
-
Bytes
public Bytes()
-
-
Method Details
-
toUnsignedString
- 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 searchedtarget- 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 searchedfrom- start index in arraytarget- 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 foundfrom- start of searchend- end of search (exclusive)target- bytes to be foundtargetFrom- actual first target byte in the target arraytargetEnd- actual end (exclusive) target byte in the target arraytargetMask- 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) -
equals
public static boolean equals(byte[] array1, byte[] array2)
-