|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.jme.util.export.ByteUtils
public class ByteUtils
ByteUtils is a helper class for converting numeric primitives
to and from byte representations.
| Constructor Summary | |
|---|---|
ByteUtils()
|
|
| Method Summary | |
|---|---|
static boolean |
convertBooleanFromBytes(byte[] byteArray)
|
static boolean |
convertBooleanFromBytes(byte[] byteArray,
int offset)
|
static double |
convertDoubleFromBytes(byte[] bytes)
|
static double |
convertDoubleFromBytes(byte[] bytes,
int offset)
|
static float |
convertFloatFromBytes(byte[] byteArray)
|
static float |
convertFloatFromBytes(byte[] byteArray,
int offset)
|
static int |
convertIntFromBytes(byte[] byteArray)
|
static int |
convertIntFromBytes(byte[] byteArray,
int offset)
|
static long |
convertLongFromBytes(byte[] bytes)
|
static long |
convertLongFromBytes(byte[] bytes,
int offset)
|
static short |
convertShortFromBytes(byte[] byteArray)
|
static short |
convertShortFromBytes(byte[] byteArray,
int offset)
|
static byte[] |
convertToBytes(boolean b)
|
static byte[] |
convertToBytes(double n)
|
static byte[] |
convertToBytes(float f)
|
static byte[] |
convertToBytes(int integer)
|
static byte[] |
convertToBytes(long n)
|
static byte[] |
convertToBytes(short value)
|
static byte[] |
getByteContent(java.io.InputStream inputStream)
Takes an InputStream and returns the complete byte content of it |
static boolean |
readBoolean(java.io.InputStream inputStream)
Read in a boolean from an InputStream |
static byte[] |
readData(byte[] store,
int bytes,
java.io.InputStream is)
Properly reads in data from the given stream until the specified number of bytes have been read. |
static double |
readDouble(java.io.InputStream inputStream)
Read in a double from an InputStream |
static float |
readFloat(java.io.InputStream inputStream)
Read in a float from an InputStream |
static int |
readInt(java.io.InputStream inputStream)
Read in an integer from an InputStream |
static long |
readLong(java.io.InputStream inputStream)
Read in a long from an InputStream |
static short |
readShort(java.io.InputStream inputStream)
Read in a short from an InputStream |
static byte[] |
rightAlignBytes(byte[] bytes,
int width)
|
static void |
writeBoolean(java.io.OutputStream outputStream,
boolean bVal)
Writes a boolean out to an OutputStream. |
static void |
writeDouble(java.io.OutputStream outputStream,
double value)
Writes a double out to an OutputStream. |
static void |
writeFloat(java.io.OutputStream outputStream,
float fVal)
Writes an float out to an OutputStream. |
static void |
writeInt(java.io.OutputStream outputStream,
int integer)
Writes an integer out to an OutputStream. |
static void |
writeLong(java.io.OutputStream outputStream,
long value)
Writes a long out to an OutputStream. |
static void |
writeShort(java.io.OutputStream outputStream,
short value)
Writes a short out to an OutputStream. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ByteUtils()
| Method Detail |
|---|
public static byte[] getByteContent(java.io.InputStream inputStream)
throws java.io.IOException
inputStream - The input stream to read from
java.io.IOException - thrown if there is a problem reading from the input stream
provided
public static void writeShort(java.io.OutputStream outputStream,
short value)
throws java.io.IOException
outputStream - The OutputStream the short will be written tovalue - The short to write
java.io.IOException - Thrown if there is a problem writing to the OutputStreampublic static byte[] convertToBytes(short value)
public static short readShort(java.io.InputStream inputStream)
throws java.io.IOException
inputStream - The InputStream used to read the short
java.io.IOException - Thrown if there is a problem reading from the InputStreampublic static short convertShortFromBytes(byte[] byteArray)
public static short convertShortFromBytes(byte[] byteArray,
int offset)
public static void writeInt(java.io.OutputStream outputStream,
int integer)
throws java.io.IOException
outputStream - The OutputStream the integer will be written tointeger - The integer to write
java.io.IOException - Thrown if there is a problem writing to the OutputStreampublic static byte[] convertToBytes(int integer)
public static int readInt(java.io.InputStream inputStream)
throws java.io.IOException
inputStream - The InputStream used to read the integer
java.io.IOException - Thrown if there is a problem reading from the InputStreampublic static int convertIntFromBytes(byte[] byteArray)
public static int convertIntFromBytes(byte[] byteArray,
int offset)
public static void writeLong(java.io.OutputStream outputStream,
long value)
throws java.io.IOException
outputStream - The OutputStream the long will be written tovalue - The long to write
java.io.IOException - Thrown if there is a problem writing to the OutputStreampublic static byte[] convertToBytes(long n)
public static long readLong(java.io.InputStream inputStream)
throws java.io.IOException
inputStream - The InputStream used to read the long
java.io.IOException - Thrown if there is a problem reading from the InputStreampublic static long convertLongFromBytes(byte[] bytes)
public static long convertLongFromBytes(byte[] bytes,
int offset)
public static void writeDouble(java.io.OutputStream outputStream,
double value)
throws java.io.IOException
outputStream - The OutputStream the double will be written tovalue - The double to write
java.io.IOException - Thrown if there is a problem writing to the OutputStreampublic static byte[] convertToBytes(double n)
public static double readDouble(java.io.InputStream inputStream)
throws java.io.IOException
inputStream - The InputStream used to read the double
java.io.IOException - Thrown if there is a problem reading from the InputStreampublic static double convertDoubleFromBytes(byte[] bytes)
public static double convertDoubleFromBytes(byte[] bytes,
int offset)
public static void writeFloat(java.io.OutputStream outputStream,
float fVal)
throws java.io.IOException
outputStream - The OutputStream the float will be written tofVal - The float to write
java.io.IOException - Thrown if there is a problem writing to the OutputStreampublic static byte[] convertToBytes(float f)
public static float readFloat(java.io.InputStream inputStream)
throws java.io.IOException
inputStream - The InputStream used to read the float
java.io.IOException - Thrown if there is a problem reading from the InputStreampublic static float convertFloatFromBytes(byte[] byteArray)
public static float convertFloatFromBytes(byte[] byteArray,
int offset)
public static void writeBoolean(java.io.OutputStream outputStream,
boolean bVal)
throws java.io.IOException
outputStream - The OutputStream the boolean will be written tobVal - The boolean to write
java.io.IOException - Thrown if there is a problem writing to the OutputStreampublic static byte[] convertToBytes(boolean b)
public static boolean readBoolean(java.io.InputStream inputStream)
throws java.io.IOException
inputStream - The InputStream used to read the boolean
java.io.IOException - Thrown if there is a problem reading from the InputStreampublic static boolean convertBooleanFromBytes(byte[] byteArray)
public static boolean convertBooleanFromBytes(byte[] byteArray,
int offset)
public static byte[] readData(byte[] store,
int bytes,
java.io.InputStream is)
throws java.io.IOException
store - the byte array to store in. Should have a length > bytesbytes - the number of bytes to read.is - the stream to read from
java.io.IOException - if an error occurs while reading from the stream
java.lang.ArrayIndexOutOfBoundsException - if bytes greater than the length of the store.
public static byte[] rightAlignBytes(byte[] bytes,
int width)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||