public class

Bytes

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

Class Overview

Utility methods for byte.

Summary

Public Constructors
Bytes()
Public Methods
static boolean equals(byte[] array1, int pos1, byte[] array2, int pos2, int size)
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 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 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)
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public Bytes ()

Public Methods

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

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

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

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

public static int lastIndexOf (byte[] array, byte[] target)

Find the last occurrence of a sequence of bytes.

Returns
  • index >= 0, or -1 if not found

public static int lastIndexOf (byte[] array, int from, byte[] target)

Find the last occurrence of a sequence of bytes.

Returns
  • index <= from, or -1 if not found

public static int lastIndexOf (byte[] array, int from, byte[] target, byte[] targetMask)

Find the last occurrence of a sequence of bytes.

Parameters
targetMask optional binary mask, must be the same length as the target if present
Returns
  • index <= from, or -1 if not found

public static String toUnsignedString (byte value)