|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectorg.mbari.siam.utils.ByteUtility
public final class ByteUtility
Utility Methods for byte arrays/strings
| Constructor Summary | |
|---|---|
ByteUtility()
|
|
| Method Summary | |
|---|---|
static boolean |
byteArrayEquals(byte[] firstArray,
byte[] secondArray)
Compare two byte arrays assumed to be the same length (or the secondArray longer firstArray) returns true if all characters match, false otherwise |
static boolean |
byteArrayEquals(byte[] firstArray,
byte[] secondArray,
int len)
Compare first len characters of two byte arrays returns true if all characters match, false otherwise |
static int |
byteArrayEquals(byte[] firstArray,
int firstOffset,
byte[] secondArray,
int secondOffset,
int len)
Compare two byte arrays returns 0 if all characters match, -1 if first mismatch < ,1 if first mismatch > |
static java.lang.String |
bytesToHexString(byte[] b)
return a hex ASCII String representation of the bytes in the byte array |
static int |
bytesToInt(byte[] bytes)
Convert a byte[] to an int assumming the bytes are in network byte order |
static int |
bytesToInt(byte[] bytes,
int offset)
Convert a byte[] to an int assumming the bytes are in network byte order |
static long |
bytesToLong(byte[] bytes)
Convert a byte[] to a long assumming the bytes are in network byte order |
static long |
bytesToLong(byte[] bytes,
int offset)
Convert a byte[] to a long assumming the bytes are in network byte order |
static boolean |
checkByteArrayLen(byte[] buf,
int len)
|
static boolean |
checkByteArrayOffset(byte[] buf,
int offset)
|
static boolean |
checkByteArrayRange(byte[] buf,
int len,
int offset)
|
static byte[] |
concatByteArrays(byte[] firstBuf,
byte[] secondBuf)
Append 'buf' to 'target' Starts at index 0 Results in buffer size buf.length+target.length |
static byte[] |
concatByteArrays(byte[] firstBuf,
int firstLen,
byte[] secondBuf,
int secondLen)
Append 'buf' to 'target' Starts at index 0 Results in buffer size bufLen+ targetLength |
static byte[] |
concatByteArrays(byte[] firstBuf,
int firstOffset,
int firstLen,
byte[] secondBuf,
int secondOffset,
int secondLen)
Append 'buf' to 'target' Starts at index iBuf of buf, iTarget of target Results in buffer size bufLen+ targetLength |
static void |
fillByteArray(byte[] array,
char fillChar)
Fill byte array with a character |
static void |
fillByteSubArray(byte[] array,
int fromIndex,
int toIndex,
char fillChar)
Fill part of byte array with a character |
static byte[] |
getByteSubArray(byte[] b,
int offset,
int len)
Returns byte array containing the bytes from b[offset] to b[offset+len] |
static byte[] |
intToBytes(int value)
Convert an int to a byte[] in network byte order |
static byte[] |
longToBytes(long value)
Convert a long to a byte[] in network byte order |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ByteUtility()
| Method Detail |
|---|
public static boolean checkByteArrayLen(byte[] buf,
int len)
public static boolean checkByteArrayOffset(byte[] buf,
int offset)
public static boolean checkByteArrayRange(byte[] buf,
int len,
int offset)
public static boolean byteArrayEquals(byte[] firstArray,
byte[] secondArray)
throws java.lang.ArrayIndexOutOfBoundsException
java.lang.ArrayIndexOutOfBoundsException
public static boolean byteArrayEquals(byte[] firstArray,
byte[] secondArray,
int len)
throws java.lang.ArrayIndexOutOfBoundsException
java.lang.ArrayIndexOutOfBoundsException
public static int byteArrayEquals(byte[] firstArray,
int firstOffset,
byte[] secondArray,
int secondOffset,
int len)
throws java.lang.ArrayIndexOutOfBoundsException
java.lang.ArrayIndexOutOfBoundsException
public static void fillByteArray(byte[] array,
char fillChar)
public static void fillByteSubArray(byte[] array,
int fromIndex,
int toIndex,
char fillChar)
public static byte[] getByteSubArray(byte[] b,
int offset,
int len)
throws java.lang.ArrayIndexOutOfBoundsException
java.lang.ArrayIndexOutOfBoundsException
public static byte[] concatByteArrays(byte[] firstBuf,
byte[] secondBuf)
throws java.lang.ArrayIndexOutOfBoundsException
java.lang.ArrayIndexOutOfBoundsException
public static byte[] concatByteArrays(byte[] firstBuf,
int firstLen,
byte[] secondBuf,
int secondLen)
throws java.lang.ArrayIndexOutOfBoundsException
java.lang.ArrayIndexOutOfBoundsException
public static byte[] concatByteArrays(byte[] firstBuf,
int firstOffset,
int firstLen,
byte[] secondBuf,
int secondOffset,
int secondLen)
throws java.lang.ArrayIndexOutOfBoundsException
java.lang.ArrayIndexOutOfBoundsExceptionpublic static byte[] intToBytes(int value)
public static byte[] longToBytes(long value)
public static int bytesToInt(byte[] bytes)
throws java.lang.ArrayIndexOutOfBoundsException
java.lang.ArrayIndexOutOfBoundsException
public static long bytesToLong(byte[] bytes)
throws java.lang.ArrayIndexOutOfBoundsException
java.lang.ArrayIndexOutOfBoundsException
public static int bytesToInt(byte[] bytes,
int offset)
throws java.lang.ArrayIndexOutOfBoundsException
java.lang.ArrayIndexOutOfBoundsException
public static long bytesToLong(byte[] bytes,
int offset)
throws java.lang.ArrayIndexOutOfBoundsException
java.lang.ArrayIndexOutOfBoundsExceptionpublic static java.lang.String bytesToHexString(byte[] b)
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||