|
OpenOffice.org XMerge API |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.openoffice.xmerge.util.EndianConverter
Helper class providing static methods to convert data to/from Network Byte Order (Big Endian).
With the introduction of java.nio.ByteOrder
and
java.nio.ByteBuffer
in Java 1.4, it may no longer be
necessary to use this class in the future.
Constructor Summary | |
EndianConverter()
|
Method Summary | |
static int |
readInt(byte[] value)
Convert a Little Endian representation of an integer to a Java int (Network Byte Order). |
static short |
readShort(byte[] value)
Convert a Little Endian representation of a short to a Java short (Network Byte Order). |
static byte[] |
writeInt(int value)
Convert an integer to a Little Endian representation. |
static byte[] |
writeShort(short value)
Convert a short to a Little Endian representation. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public EndianConverter()
Method Detail |
public static int readInt(byte[] value)
Convert a Little Endian representation of an integer to a Java
int
(Network Byte Order).
An array with more than four elements can be used, but only the first four elements will be read.
value
- byte
array containing the LE representation
of the value.int
containing the converted value.public static short readShort(byte[] value)
Convert a Little Endian representation of a short to a Java
short
(Network Byte Order).
An array with more than two elements can be used, but only the first two elements will be read.
value
- byte
array containing the LE representation
of the value.short
containing the converted value.public static byte[] writeInt(int value)
Convert an integer to a Little Endian representation.
value
- The int
to be converted.byte
array containing the converted
value.public static byte[] writeShort(short value)
Convert a short
to a Little Endian representation.
value
- The short
to be converted.byte
array containing the converted
value.
|
OpenOffice.org XMerge API |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |