Maven module :un.api : api-common :
Class : un.api.number.NumberEncoding
Extends/Implements : -
Subclasses : -

Numbers can be encoded in Little-Endian or Big-Endian.
This interface and implementation allow to read and write primitive types
from /to byte arrays.
author  Johann Sorel


Variables : LITTLE_ENDIAN, BIG_ENDIAN
Functions : readBoolean, readBoolean, readByte, readByte, readUByte, readUByte, readShort, readUShort, readInt24, readUInt24, readInt, readUInt, readLong, readFloat, readDouble, writeByte, writeUByte, writeChar, writeShort, writeUShort, writeInt24, writeUInt24, writeInt, writeUInt, writeLong, writeFloat, writeDouble


public LittleEndian LITTLE_ENDIAN

public BigEndian BIG_ENDIAN



Read a boolean value.
param  b data
return  value
boolean readBoolean (int b)


Read a boolean value at given offset in array.
param  buffer data array
param  offset position where to start reading
return  value
boolean readBoolean (byte[] buffer, int offset)


Read a byte value.
param  b data
return  value
byte readByte (int b)


Read a byte value at given offset in array.
param  buffer data array
param  offset position where to start reading
return  value
byte readByte (byte[] buffer, int offset)


Read an unsigned byte value.
param  b data
return  value
int readUByte (int b)


Read an unsigned byte value at given offset in array.
param  buffer data array
param  offset position where to start reading
return  value
int readUByte (byte[] buffer, int offset)


Read a short value at given offset in array.
param  buffer data array
param  offset position where to start reading
return  value
short readShort (byte[] buffer, int offset)


Read an unsigned short value at given offset in array.
param  buffer data array
param  offset position where to start reading
return  value
int readUShort (byte[] buffer, int offset)


Read a integer on 24 bits value at given offset in array.
param  buffer data array
param  offset position where to start reading
return  value
int readInt24 (byte[] buffer, int offset)


Read an unsigned integer on 24 bits value at given offset in array.
param  buffer data array
param  offset position where to start reading
return  value
int readUInt24 (byte[] buffer, int offset)


Read an integer value at given offset in array.
param  buffer data array
param  offset position where to start reading
return  value
int readInt (byte[] buffer, int offset)


Read an unsigned integer value at given offset in array.
param  buffer data array
param  offset position where to start reading
return  value
long readUInt (byte[] buffer, int offset)


Read a long value at given offset in array.
param  buffer data array
param  offset position where to start reading
return  value
long readLong (byte[] buffer, int offset)


Read a float value at given offset in array.
param  buffer data array
param  offset position where to start reading
return  value
float readFloat (byte[] buffer, int offset)


Read a double value at given offset in array.
param  buffer data array
param  offset position where to start reading
return  value
double readDouble (byte[] buffer, int offset)


Write a byte value at given offset in array.
param  value to write
param  buffer byte array to write into
param  offset position where to start writing
void writeByte (byte value, byte[] buffer, int offset)


Write an unsigned byte value at given offset in array.
param  value to write
param  buffer byte array to write into
param  offset position where to start writing
void writeUByte (int value, byte[] buffer, int offset)


Write a char value at given offset in array.
param  value to write
param  buffer byte array to write into
param  offset position where to start writing
void writeChar (char value, byte[] buffer, int offset)


Write a short value at given offset in array.
param  value to write
param  buffer byte array to write into
param  offset position where to start writing
void writeShort (short value, byte[] buffer, int offset)


Write an unsigned short value at given offset in array.
param  value to write
param  buffer byte array to write into
param  offset position where to start writing
void writeUShort (int value, byte[] buffer, int offset)


Write an integer on 24 bits value at given offset in array.
param  value to write
param  buffer byte array to write into
param  offset position where to start writing
void writeInt24 (int value, byte[] buffer, int offset)


Write an unsigned integer on 24bits value at given offset in array.
param  value to write
param  buffer byte array to write into
param  offset position where to start writing
void writeUInt24 (int value, byte[] buffer, int offset)


Write an integer value at given offset in array.
param  value to write
param  buffer byte array to write into
param  offset position where to start writing
void writeInt (int value, byte[] buffer, int offset)


Write an unsigned integer value at given offset in array.
param  value to write
param  buffer byte array to write into
param  offset position where to start writing
void writeUInt (long value, byte[] buffer, int offset)


Write a long value at given offset in array.
param  value to write
param  buffer byte array to write into
param  offset position where to start writing
void writeLong (long value, byte[] buffer, int offset)


Write a float value at given offset in array.
param  value to write
param  buffer byte array to write into
param  offset position where to start writing
void writeFloat (float value, byte[] buffer, int offset)


Write a double value at given offset in array.
param  value to write
param  buffer byte array to write into
param  offset position where to start writing
void writeDouble (double value, byte[] buffer, int offset)