|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object marf.util.ByteUtils
public class ByteUtils
Byte-Array Conversion Utility Functions.
$Id: ByteUtils.java,v 1.9 2008/02/21 19:57:44 mokhov Exp $
Constructor Summary | |
---|---|
protected |
ByteUtils()
Allow derivatives. |
Method Summary | |
---|---|
static int |
byteArrayToInt(byte[] paRawBytes,
boolean pbBigEndian)
Converts a byte array to int value. |
static int |
byteArrayToInt(byte[] paRawBytes,
int piOffset,
boolean pbBigEndian)
Converts a portion of a byte array with given offset to int value. |
static short |
byteArrayToShort(byte[] paRawBytes,
boolean pbBigEndian)
Converts a byte array to short value. |
static short |
byteArrayToShort(byte[] paRawBytes,
int piOffset,
boolean pbBigEndian)
Converts a portion of a byte array with given offset to short value. |
static java.lang.String |
byteArrayToString(byte[] paRawBytes)
Converts a byte array to String value. |
static java.lang.String |
byteArrayToString(byte[] paRawBytes,
int piOffset,
int piLength)
Converts a portion of a byte array to String value. |
static java.lang.String |
getMARFSourceCodeRevision()
Returns source code revision information. |
static byte[] |
intToByteArray(int piValueToConvert,
boolean pbBigEndian)
Converts an int value to a byte array. |
static byte[] |
stringToByteArray(java.lang.String pstrStringToConvert)
Converts a String value to a byte array in US-ASCII charset. |
static byte[] |
stringToByteArray(java.lang.String pstrStringToConvert,
java.lang.String pstrCharSet)
Attempts to convert a String value to a byte array in specified charset. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected ByteUtils()
Method Detail |
---|
public static short byteArrayToShort(byte[] paRawBytes, boolean pbBigEndian)
paRawBytes
- the byte arraypbBigEndian
- true if the bytes are in Big-endian order; false otherwise
public static short byteArrayToShort(byte[] paRawBytes, int piOffset, boolean pbBigEndian)
paRawBytes
- the byte arraypiOffset
- offset in the original array to start reading bytes frompbBigEndian
- true if the bytes are in Big-endian order; false otherwise
public static int byteArrayToInt(byte[] paRawBytes, boolean pbBigEndian)
paRawBytes
- the byte arraypbBigEndian
- true if the bytes are in Big-endian order; false otherwise
public static int byteArrayToInt(byte[] paRawBytes, int piOffset, boolean pbBigEndian)
paRawBytes
- the byte arraypiOffset
- offset in the original array to start reading bytes frompbBigEndian
- true if the bytes are in Big-endian order; false otherwise
public static byte[] intToByteArray(int piValueToConvert, boolean pbBigEndian)
piValueToConvert
- the original integerpbBigEndian
- true if the bytes are in Big-endian order; false otherwise
public static java.lang.String byteArrayToString(byte[] paRawBytes)
paRawBytes
- the byte array, non-UNICODE
public static java.lang.String byteArrayToString(byte[] paRawBytes, int piOffset, int piLength)
paRawBytes
- the byte array, non-UNICODEpiOffset
- offset in the original array to start reading bytes frompiLength
- how many bytes of the array parameter to interpret as String
public static byte[] stringToByteArray(java.lang.String pstrStringToConvert)
pstrStringToConvert
- the original string
public static byte[] stringToByteArray(java.lang.String pstrStringToConvert, java.lang.String pstrCharSet)
pstrStringToConvert
- the original stringpstrCharSet
- character set to assume for the original string
public static java.lang.String getMARFSourceCodeRevision()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |