final class LittleEndian extends Object
This class is safe for multithreading.
| Modifier | Constructor and Description |
|---|---|
private |
LittleEndian()
This class cannot get instantiated.
|
| Modifier and Type | Method and Description |
|---|---|
static int |
readInt(byte[] buf,
int off)
Reads a signed integer value from the byte array
buf at the offset off
as four bytes, low byte first. |
static long |
readLong(byte[] buf,
int off)
Reads a (signed) long integer value from the byte array
buf at the offset off
as eight bytes, low byte first. |
static short |
readShort(byte[] buf,
int off)
Reads a signed short integer value from the byte array
buf at the offset off
as two bytes, low byte first. |
static long |
readUInt(byte[] buf,
int off)
Reads an unsigned integer value from the byte array
buf at the offset off
as four bytes, low byte first. |
static int |
readUShort(byte[] buf,
int off)
Reads an unsigned short integer value from the byte array
buf at the offset off
as two bytes, low byte first. |
static void |
writeInt(int i,
byte[] buf,
int off)
Writes the integer value
i to the byte array
buf at the zero based offset off
as four bytes, low byte first. |
static void |
writeLong(long l,
byte[] buf,
int off)
Writes the long integer value
l to the byte array
buf at the zero based offset off
as eight bytes, low byte first. |
static void |
writeShort(int s,
byte[] buf,
int off)
Writes the integer value
s to the byte array
buf at the zero based offset off
as two bytes, low byte first. |
public static short readShort(byte[] buf,
int off)
buf at the offset off
as two bytes, low byte first.buf - The byte array to read the signed short integer value from.off - The zero based offset in the byte array where the first byte
of the signed short integer value is read from.public static int readUShort(byte[] buf,
int off)
buf at the offset off
as two bytes, low byte first.
Note that it is not necessary to check the return value with
UShort.check(int, java.lang.String, java.lang.String).buf - The byte array to read the unsigned short integer value from.off - The zero based offset in the byte array where the first byte
of the unsigned short integer value is read from.unsigned short as a primitive
type, hence an int is returned which's two most
significant bytes are zero.public static int readInt(byte[] buf,
int off)
buf at the offset off
as four bytes, low byte first.buf - The byte array to read the signed integer value from.off - The zero based offset in the byte array where the first byte
of the signed integer value is read from.public static long readUInt(byte[] buf,
int off)
buf at the offset off
as four bytes, low byte first.
Note that it is not necessary to check the return value with
UInt.check(long, java.lang.String, java.lang.String).buf - The byte array to read the unsigned integer value from.off - The zero based offset in the byte array where the first byte
of the unsigned integer value is read from.unsigned int as a primitive
type, hence a long is returned which's four most
significant bytes are zero.public static long readLong(byte[] buf,
int off)
buf at the offset off
as eight bytes, low byte first.buf - The byte array to read the signed long integer value from.off - The zero based offset in the byte array where the first byte
of the (signed) long integer value is read from.public static void writeShort(int s,
byte[] buf,
int off)
s to the byte array
buf at the zero based offset off
as two bytes, low byte first.
The most significant two bytes of the integer value are ignored.s - The short integer value to be written.buf - The byte array to write the short integer value to.off - The zero based offset in the byte array where the first byte
of the short integer value is written to.public static void writeInt(int i,
byte[] buf,
int off)
i to the byte array
buf at the zero based offset off
as four bytes, low byte first.i - The integer value to be written.buf - The byte array to write the integer value to.off - The zero based offset in the byte array where the first byte
of the integer value is written to.public static void writeLong(long l,
byte[] buf,
int off)
l to the byte array
buf at the zero based offset off
as eight bytes, low byte first.l - The long integer value to be written.buf - The byte array to write the long integer value to.off - The zero based offset in the byte array where the first byte
of the long integer value is written to.Copyright © 2005-2011 Schlichtherle IT Services. All Rights Reserved.