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 intindexOf(byte[] array, byte[] search, int searchOffset) static byte[]static byte[]reverse(byte[] inArray) static booleanstartsWith(byte[] haystack, byte[] needle) static booleanstartsWith(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 withinarrayto start the search.- Returns:
- Offset of the first match, or
-1if 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
haystackstarts 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 withinhaystackto start searching.- Returns:
- Whether
haystackstarts withneedleat the given offset.
-