de.intarsys.tools.collection
Class ByteArrayTools
java.lang.Object
de.intarsys.tools.collection.ByteArrayTools
public class ByteArrayTools
- extends Object
Method Summary |
static byte[] |
concat(byte[] array1,
byte[] array2)
|
static byte[] |
copy(byte[] bytes)
Make a copy of bytes . |
static byte[] |
copy(byte[] bytes,
int offset,
int length)
Copy length bytes from bytes starting at
from . |
static int |
indexOf(byte[] source,
int sourceOffset,
int sourceLen,
byte[] pattern,
int patternOffset,
int patternLen,
int fromIndex)
Search index of pattern in source. |
static boolean |
startsWith(byte[] bytes,
byte[] pattern)
true if bytes starts with the byte sequence
defined in pattern . |
ByteArrayTools
public ByteArrayTools()
concat
public static byte[] concat(byte[] array1,
byte[] array2)
copy
public static byte[] copy(byte[] bytes)
- Make a copy of
bytes
.
- Parameters:
bytes
- byte[] to be copied
- Returns:
- A copy of
bytes
copy
public static byte[] copy(byte[] bytes,
int offset,
int length)
- Copy
length
bytes from bytes
starting at
from
.
- 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)
true
if bytes
starts with the byte sequence
defined in pattern
.
- Parameters:
bytes
- pattern
-
- Returns:
true
if bytes
starts with the byte
sequence defined in pattern
.
Copyright © 2008 intarsys consulting GmbH. All Rights Reserved.