Package de.intarsys.tools.collection
Class ByteArrayTools
- java.lang.Object
-
- de.intarsys.tools.collection.ByteArrayTools
-
public class ByteArrayTools extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description ByteArrayTools()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static byte[]concat(byte[] array1, byte[] array2)static byte[]copy(byte[] bytes)Make a copy ofbytes.static byte[]copy(byte[] bytes, int offset, int length)Copylengthbytes frombytesstarting atfrom.static intindexOf(byte[] source, int sourceOffset, int sourceLen, byte[] pattern, int patternOffset, int patternLen, int fromIndex)Search index of pattern in source.static booleanstartsWith(byte[] bytes, byte[] pattern)trueifbytesstarts with the byte sequence defined inpattern.
-
-
-
Method Detail
-
concat
public static byte[] concat(byte[] array1, byte[] array2)
-
copy
public static byte[] copy(byte[] bytes)
Make a copy ofbytes.- Parameters:
bytes- byte[] to be copied- Returns:
- A copy of
bytes
-
copy
public static byte[] copy(byte[] bytes, int offset, int length)Copylengthbytes frombytesstarting atfrom.- Parameters:
bytes- byte[] to be copiedoffset- starting position to copy fromlength- number of bytes- Returns:
- A copy of
bytes
-
indexOf
public static int indexOf(byte[] source, int sourceOffset, int sourceLen, byte[] pattern, int patternOffset, int patternLen, int fromIndex)Search index of pattern in source. Algorithm from java.lang.String- Parameters:
source-sourceOffset-sourceLen-pattern-patternOffset-patternLen-fromIndex-- Returns:
- The index of the first occurrence of pattern or -1.
-
startsWith
public static boolean startsWith(byte[] bytes, byte[] pattern)trueifbytesstarts with the byte sequence defined inpattern.- Parameters:
bytes-pattern-- Returns:
trueifbytesstarts with the byte sequence defined inpattern.
-
-