|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.mina.proxy.utils.ByteUtilities
public class ByteUtilities
ByteUtilities.java - Byte manipulation functions.
Constructor Summary | |
---|---|
ByteUtilities()
|
Method Summary | |
---|---|
static byte[] |
asByteArray(String hex)
|
static String |
asHex(byte[] bytes)
|
static String |
asHex(byte[] bytes,
String separator)
|
static void |
changeByteEndianess(byte[] b,
int offset,
int length)
|
static void |
changeWordEndianess(byte[] b,
int offset,
int length)
|
static byte[] |
encodeString(String s,
boolean useUnicode)
|
static byte[] |
getOEMStringAsByteArray(String s)
|
static byte[] |
getUTFStringAsByteArray(String s)
|
static byte[] |
intToNetworkByteOrder(int num,
byte[] buf,
int start,
int count)
Encodes an integer into 4 bytes in network byte order in the buffer supplied. |
static boolean |
isFlagSet(int flagSet,
int testFlag)
Return true if the flag testFlag is set in the
flags flagset. |
static int |
makeIntFromByte2(byte[] b)
|
static int |
makeIntFromByte2(byte[] b,
int offset)
|
static int |
makeIntFromByte4(byte[] b)
|
static int |
makeIntFromByte4(byte[] b,
int offset)
|
static int |
networkByteOrderToInt(byte[] buf,
int start,
int count)
Returns the integer represented by 4 bytes in network byte order. |
static byte[] |
writeInt(int v)
Write a 32 bit int as LITTLE_ENDIAN. |
static byte[] |
writeInt(int v,
byte[] b,
int offset)
Write a 32 bit int as LITTLE_ENDIAN to the given array b at offset offset . |
static byte[] |
writeShort(short v)
Write a 16 bit short as LITTLE_ENDIAN. |
static byte[] |
writeShort(short v,
byte[] b,
int offset)
Write a 16 bit short as LITTLE_ENDIAN to the given array b at offset offset . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ByteUtilities()
Method Detail |
---|
public static int networkByteOrderToInt(byte[] buf, int start, int count)
public static byte[] intToNetworkByteOrder(int num, byte[] buf, int start, int count)
public static final byte[] writeShort(short v)
v
- the short to writepublic static final byte[] writeShort(short v, byte[] b, int offset)
b
at offset offset
.
v
- the short to writepublic static final byte[] writeInt(int v)
v
- the int to writepublic static final byte[] writeInt(int v, byte[] b, int offset)
b
at offset offset
.
v
- the int to writepublic static final void changeWordEndianess(byte[] b, int offset, int length)
public static final void changeByteEndianess(byte[] b, int offset, int length)
public static final byte[] getOEMStringAsByteArray(String s) throws UnsupportedEncodingException
UnsupportedEncodingException
public static final byte[] getUTFStringAsByteArray(String s) throws UnsupportedEncodingException
UnsupportedEncodingException
public static final byte[] encodeString(String s, boolean useUnicode) throws UnsupportedEncodingException
UnsupportedEncodingException
public static String asHex(byte[] bytes)
public static String asHex(byte[] bytes, String separator)
public static byte[] asByteArray(String hex)
public static final int makeIntFromByte4(byte[] b)
public static final int makeIntFromByte4(byte[] b, int offset)
public static final int makeIntFromByte2(byte[] b)
public static final int makeIntFromByte2(byte[] b, int offset)
public static final boolean isFlagSet(int flagSet, int testFlag)
testFlag
is set in the
flags
flagset.
flagset
- the flagset to testtestFlag
- the flag we search the presence of
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |