Class ArrayUtils
java.lang.Object
is.galia.util.ArrayUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic List
<byte[]> chunkify
(byte[] bytes, int maxChunkSize) Splits the given data into chunks no larger than the given size.static int
indexOf
(byte[] array, byte[] search, int searchOffset) static byte[]
static byte[]
reverse
(byte[] inArray) static boolean
startsWith
(byte[] haystack, byte[] needle) static boolean
startsWith
(byte[] haystack, byte[] needle, int haystackOffset)
-
Method Details
-
chunkify
Splits the given data into chunks no larger than the given size. The last chunk may be smaller than the others.- Parameters:
bytes
- Data to chunkify.maxChunkSize
- Maximum chunk size.- Returns:
- Chunked data.
-
indexOf
public static int indexOf(byte[] array, byte[] search, int searchOffset) - Parameters:
array
- Bytes to search within.search
- Bytes to search for.searchOffset
- Offset withinarray
to start the search.- Returns:
- Offset of the first match, or
-1
if not found.
-
merge
- Parameters:
chunks
- Ordered list of chunks to merge.- Returns:
- Merged chunks.
-
reverse
public static byte[] reverse(byte[] inArray) - Parameters:
inArray
- Array to reverse.- Returns:
- New reversed array.
-
startsWith
public static boolean startsWith(byte[] haystack, byte[] needle) - Parameters:
haystack
- Bytes to search against.needle
- Bytes to search for.- Returns:
- Whether
haystack
starts withneedle
.
-
startsWith
public static boolean startsWith(byte[] haystack, byte[] needle, int haystackOffset) - Parameters:
haystack
- Bytes to search against.needle
- Bytes to search for.haystackOffset
- Offset withinhaystack
to start searching.- Returns:
- Whether
haystack
starts withneedle
at the given offset.
-