|
copyright The Portico Project 2008. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.portico.shared.compat.JEncodingHelpers
public class JEncodingHelpers
A set of encoding helpers (based on the HLA 1.3 encoding helpers) that can be used safely without referring to any specific HLA version.
Constructor Summary | |
---|---|
JEncodingHelpers()
|
Method Summary | |
---|---|
static boolean |
decodeBoolean(byte[] buffer)
Decodes a big-endian 32-bit integer in a buffer into a boolean. |
static boolean |
decodeBoolean(byte[] buffer,
int offset)
Decodes a big-endian 32-bit integer in a 4-byte buffer at the specified offset int a boolean value. |
static byte |
decodeByte(byte[] buffer)
Decodes a byte from a buffer. |
static byte |
decodeByte(byte[] buffer,
int offset)
Decodes a byte from a buffer at the specified offset. |
static char |
decodeChar(byte[] buffer)
Decodes a big-endian 16-bit integer in a buffer into a char value. |
static char |
decodeChar(byte[] buffer,
int offset)
Decodes a big-endian 16-bit integer in a buffer at the specified offset into a char value. |
static double |
decodeDouble(byte[] buffer)
Decodes a big-endian 64-bit integer stored in buffer into a long value and converts that to a double value, which is returned. |
static double |
decodeDouble(byte[] buffer,
int offset)
Decodes a big-endian 64-bit integer stored in buffer at specified offset into a long value and converts that to a double value, which is returned. |
static float |
decodeFloat(byte[] buffer)
Decodes a big-endian 32-bit integer stored in buffer into an int value and converts that to a float value, which is returned. |
static float |
decodeFloat(byte[] buffer,
int offset)
Decodes a big-endian 32-bit integer stored in buffer at specified offset into an int value and converts that to a float value, which is returned. |
static int |
decodeInt(byte[] buffer)
Decodes a big-endian 32-bit integer stored in buffer into an int value. |
static int |
decodeInt(byte[] buffer,
int offset)
Decodes a big-endian 32-bit integer stored in buffer at specified offset into an int value. |
static long |
decodeLong(byte[] buffer)
Decodes a big-endian 64-bit integer stored in buffer into a long value. |
static long |
decodeLong(byte[] buffer,
int offset)
Decodes a big-endian 64-bit integer stored in buffer at specified offset into a long value. |
static short |
decodeShort(byte[] buffer)
Decodes a big-endian 16-bit integer stored in buffer into a short value. |
static short |
decodeShort(byte[] buffer,
int offset)
Decodes a big-endian 16-bit integer stored in buffer at specified offset into a short value. |
static String |
decodeString(byte[] buffer)
Decodes a string from a buffer and strips the final null character. |
static byte[] |
encodeBoolean(boolean value)
Encodes a boolean value as a big-endian 32-bit integer in a 4-byte buffer and returns the buffer. |
static void |
encodeBoolean(boolean value,
byte[] buffer,
int offset)
Encodes a boolean value as a big-endian 32-bit integer into the specified buffer at the specified offset. |
static byte[] |
encodeByte(int value)
Encodes a byte in a buffer and returns the buffer. |
static void |
encodeByte(int value,
byte[] buffer,
int offset)
Encodes a byte into a buffer at the specified offset. |
static byte[] |
encodeChar(char value)
Encodes a char value as a big-endian 16-bit integer into a 2-byte buffer and returns the buffer. |
static void |
encodeChar(char value,
byte[] buffer,
int offset)
Encodes a char value as a big-endian 16-bit integer into a buffer at the specified offset. |
static byte[] |
encodeDouble(double value)
Converts a double value to a long and stores that long value as a big-endian 64-bit integer in an 8-byte buffer and returns that buffer. |
static void |
encodeDouble(double value,
byte[] buffer,
int offset)
Converts a double value to a long and stores that long value as a big-endian 64-bit integer into buffer at specified offset. |
static byte[] |
encodeFloat(float value)
Converts a float value to an int and stores that int value as a big-endian 32-bit integer in a 4-byte buffer and returns that buffer. |
static void |
encodeFloat(float value,
byte[] buffer,
int offset)
Converts a float value to an int and stores that int value as a big-endian 32-bit integer in the specified buffer at a specified offset. |
static byte[] |
encodeInt(int value)
Encodes an int as a big-endian 32-bit integer into a 4-byte buffer and returns the buffer. |
static void |
encodeInt(int value,
byte[] buffer,
int offset)
Encodes an int as a big-endian 32-bit integer into buffer at the specified offset. |
static byte[] |
encodeLong(long value)
Encodes a long value as a big-endian 64-bit integer into a 8-byte buffer and returns the buffer. |
static void |
encodeLong(long value,
byte[] buffer,
int offset)
Encodes a long value as a big-endian 64-bit integer into a buffer at specified offset. |
static byte[] |
encodeShort(short value)
Encodes a short value as a big-endian 16-bit integer into a 2-byte buffer and returns that buffer. |
static void |
encodeShort(short value,
byte[] buffer,
int offset)
Encodes a short value as a big-endian 16-bit integer into a buffer at the specified offset. |
static byte[] |
encodeString(String str)
Appends a null character to the string and returns a buffer containing the encoded string. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JEncodingHelpers()
Method Detail |
---|
public static byte[] encodeBoolean(boolean value)
value
- Value to encode
public static void encodeBoolean(boolean value, byte[] buffer, int offset)
value
- Value to encodebuffer
- Buffer to store value inoffset
- Offset in bufferpublic static boolean decodeBoolean(byte[] buffer)
buffer
- Buffer containing encoded value
public static boolean decodeBoolean(byte[] buffer, int offset)
buffer
- Buffer containing encoded valueoffset
- Offset in buffer
public static byte[] encodeByte(int value)
value
- Value to encode
public static void encodeByte(int value, byte[] buffer, int offset)
value
- Value to encodebuffer
- Buffer to store value inoffset
- Offset in bufferpublic static byte decodeByte(byte[] buffer)
buffer
- Buffer containing encoded value
public static byte decodeByte(byte[] buffer, int offset)
buffer
- Buffer containing encoded valueoffset
- Offset in buffer
public static byte[] encodeChar(char value)
value
- Value to encode
public static void encodeChar(char value, byte[] buffer, int offset)
value
- Value to encodebuffer
- Buffer to encode value inoffset
- Offset in bufferpublic static char decodeChar(byte[] buffer)
buffer
- Buffer containing encoded value
public static char decodeChar(byte[] buffer, int offset)
buffer
- Buffer containing encoded valueoffset
- Offset in buffer
public static byte[] encodeDouble(double value)
value
- Value to encode
public static void encodeDouble(double value, byte[] buffer, int offset)
value
- Value to encodebuffer
- Buffer to store value inoffset
- Offset in bufferpublic static double decodeDouble(byte[] buffer)
buffer
- Buffer containing encoded value
public static double decodeDouble(byte[] buffer, int offset)
buffer
- Buffer containing encoded valueoffset
- Offset in buffer
public static byte[] encodeFloat(float value)
value
- Value to encode
public static void encodeFloat(float value, byte[] buffer, int offset)
value
- Value to encodebuffer
- Buffer to store value inoffset
- Offset in bufferpublic static float decodeFloat(byte[] buffer)
buffer
- Buffer containing encoded value
public static float decodeFloat(byte[] buffer, int offset)
buffer
- Buffer containing encoded valueoffset
- Offset in buffer
public static byte[] encodeInt(int value)
value
- Value to encode
public static void encodeInt(int value, byte[] buffer, int offset)
value
- Value to encodebuffer
- Buffer to store value inoffset
- Offset in bufferpublic static int decodeInt(byte[] buffer)
buffer
- Buffer containing encoded value
public static int decodeInt(byte[] buffer, int offset)
buffer
- Buffer containing encoded valueoffset
- Offset in buffer
public static byte[] encodeLong(long value)
value
- Value to encode
public static void encodeLong(long value, byte[] buffer, int offset)
value
- Value to encodebuffer
- Buffer to store value inoffset
- Offset in bufferpublic static long decodeLong(byte[] buffer)
buffer
- Buffer containing encoded value
public static long decodeLong(byte[] buffer, int offset)
buffer
- Buffer containing encoded valueoffset
- Offset in buffer
public static byte[] encodeShort(short value)
value
- Value to encode
public static void encodeShort(short value, byte[] buffer, int offset)
value
- Value to encodebuffer
- Buffer to store value inoffset
- Offset in bufferpublic static short decodeShort(byte[] buffer)
buffer
- Buffer containing encoded value
public static short decodeShort(byte[] buffer, int offset)
buffer
- Buffer containing encoded valueoffset
- Offset in buffer
public static byte[] encodeString(String str)
str
- String to encode
public static String decodeString(byte[] buffer)
buffer
- Buffer with encoded string
|
copyright The Portico Project 2008. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |