|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.owasp.esapi.util.ByteConversionUtil
public class ByteConversionUtil
Conversion to/from byte arrays to/from short, int, long. The assumption is that they byte arrays are in network byte order (i.e., big-endian ordered).
CipherTextSerializer
Constructor Summary | |
---|---|
ByteConversionUtil()
|
Method Summary | |
---|---|
static byte[] |
fromInt(int input)
Returns a byte array containing 4 network byte-ordered bytes representing the given int . |
static byte[] |
fromLong(long input)
Returns a byte array containing 8 network byte-ordered bytes representing the given long . |
static byte[] |
fromShort(short input)
Returns a byte array containing 2 network byte ordered bytes representing the given short . |
static int |
toInt(byte[] input)
Converts a given byte array to an int . |
static long |
toLong(byte[] input)
Converts a given byte array to a long . |
static short |
toShort(byte[] input)
Converts a given byte array to an short . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ByteConversionUtil()
Method Detail |
---|
public static byte[] fromShort(short input)
short
.
input
- An short
to convert to a byte array.
short
in network byte
order (i.e., big-endian order).public static byte[] fromInt(int input)
int
.
input
- An int
to convert to a byte array.
int
in network byte order
(i.e., big-endian order).public static byte[] fromLong(long input)
long
.
input
- The long
to convert to a byte
array.
long
.public static short toShort(byte[] input)
short
. Bytes are expected in
network byte
order.
input
- A network byte-ordered representation of an short
.
short
value represented by the input array.public static int toInt(byte[] input)
int
. Bytes are expected in
network byte order.
input
- A network byte-ordered representation of an int
.
int
value represented by the input array.public static long toLong(byte[] input)
long
. Bytes are expected in
network byte
input
- A network byte-ordered representation of a long
.
long
value represented by the input array
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |