Mallet Engine  2
Entity-Component based game engine, written in Java.
 All Classes Namespaces Files Functions Variables
Static Public Member Functions | Static Public Attributes
com.linxonline.mallet.util.tools.ConvertBytes Class Reference

List of all members.

Static Public Member Functions

static int nativeOrder ()
static byte[] toBytes (final int _int, final int _endian)
static byte[] toBytes (final byte _byte, final int _endian)
static byte[] toBytes (final char _char, final int _endian)
static byte[] toBytes (final long _long, final int _endian)
static byte[] toBytes (final short _short, final int _endian)
static byte[] toBytes (final float _float, final int _endian)
static byte[] toBytes (final double _double, final int _endian)
static byte[] toBytes (final boolean _bool, final int _endian)
static byte[] toBytes (final int[] _int, final int _endian)
static byte[] toBytes (final char[] _char, final int _endian)
static byte[] toBytes (final short[] _short, final int _endian)
static byte[] toBytes (final long[] _long, final int _endian)
static byte[] toBytes (final float[] _float, final int _endian)
static byte[] toBytes (final double[] _double, final int _endian)
static int toInt (final byte[] _int, final int _offset, int _length)
static char toChar (final byte[] _char, final int _offset, int _length)
static long toLong (final byte[] _long, final int _offset, int _length)
static short toShort (final byte[] _short, final int _offset, int _length)
static float toFloat (final byte[] _float, final int _offset, int _length)
static double toDouble (final byte[] _double, final int _offset, int _length)
static boolean toBoolean (final byte[] _bool, final int _offset, int _length)
static byte[] toBytes (final byte[] _bytes, final int _offset, int _length)
static byte[] newflipEndian (final byte[] _bytes)
static byte[] flipEndian (final byte[] _bytes)
static byte[] newflipEndian (final byte[] _bytes, final int _offset, final int _length)
static byte[] flipEndian (final byte[] _bytes, final int _offset, final int _length)
static int toInteger (final byte[] _bytes)
static short toShort (final byte[] _bytes)
static short[] toShorts (final byte[] _bytes)

Static Public Attributes

static final int LITTLE_ENDIAN = 1
static final int BIG_ENDIAN = 2

Detailed Description

Byte = 1 Byte | Char = 2 Bytes Int = 4 Bytes | Float = 4 Bytes Double = 8 Bytes | Long = 8 Bytes.

When converting a variable to a byte-stream, you must define the endianese. This will detrmine the byte-order of the returned byte-stream.

When converting a byte-stream to a variable it doe snot convert it to the appropriate endianese of the system.

Use flipEndian to change the endianese of a byte-stream or sub-set of a byte-stream. If the byte-stream contains multiple variables, then the variable positions will also be invereted.


Member Function Documentation

static byte [] com.linxonline.mallet.util.tools.ConvertBytes.flipEndian ( final byte[]  _bytes) [static]

Modifies passed in byte-stream, returns the same stream.

static byte [] com.linxonline.mallet.util.tools.ConvertBytes.flipEndian ( final byte[]  _bytes,
final int  _offset,
final int  _length 
) [static]

Modifies passed in byte-stream, returns the same stream. Allows you to flip the endian of a defined part of the byte-stream.

Returns the platforms native Endianese

static byte [] com.linxonline.mallet.util.tools.ConvertBytes.newflipEndian ( final byte[]  _bytes) [static]

FLIP BYTE ARRAY ENDIAN

static byte [] com.linxonline.mallet.util.tools.ConvertBytes.newflipEndian ( final byte[]  _bytes,
final int  _offset,
final int  _length 
) [static]

Allows you to flip the endian of a defined part of the byte-stream.

static boolean com.linxonline.mallet.util.tools.ConvertBytes.toBoolean ( final byte[]  _bool,
final int  _offset,
int  _length 
) [static]
static byte [] com.linxonline.mallet.util.tools.ConvertBytes.toBytes ( final int  _int,
final int  _endian 
) [static]

VARIABLE to BYTE ARRAY

static byte [] com.linxonline.mallet.util.tools.ConvertBytes.toBytes ( final byte  _byte,
final int  _endian 
) [static]
static byte [] com.linxonline.mallet.util.tools.ConvertBytes.toBytes ( final char  _char,
final int  _endian 
) [static]
static byte [] com.linxonline.mallet.util.tools.ConvertBytes.toBytes ( final long  _long,
final int  _endian 
) [static]
static byte [] com.linxonline.mallet.util.tools.ConvertBytes.toBytes ( final short  _short,
final int  _endian 
) [static]
static byte [] com.linxonline.mallet.util.tools.ConvertBytes.toBytes ( final float  _float,
final int  _endian 
) [static]
static byte [] com.linxonline.mallet.util.tools.ConvertBytes.toBytes ( final double  _double,
final int  _endian 
) [static]
static byte [] com.linxonline.mallet.util.tools.ConvertBytes.toBytes ( final boolean  _bool,
final int  _endian 
) [static]
static byte [] com.linxonline.mallet.util.tools.ConvertBytes.toBytes ( final int[]  _int,
final int  _endian 
) [static]

VARIABLE ARRAY to BYTE ARRAY

static byte [] com.linxonline.mallet.util.tools.ConvertBytes.toBytes ( final char[]  _char,
final int  _endian 
) [static]
static byte [] com.linxonline.mallet.util.tools.ConvertBytes.toBytes ( final short[]  _short,
final int  _endian 
) [static]
static byte [] com.linxonline.mallet.util.tools.ConvertBytes.toBytes ( final long[]  _long,
final int  _endian 
) [static]
static byte [] com.linxonline.mallet.util.tools.ConvertBytes.toBytes ( final float[]  _float,
final int  _endian 
) [static]
static byte [] com.linxonline.mallet.util.tools.ConvertBytes.toBytes ( final double[]  _double,
final int  _endian 
) [static]
static byte [] com.linxonline.mallet.util.tools.ConvertBytes.toBytes ( final byte[]  _bytes,
final int  _offset,
int  _length 
) [static]
static char com.linxonline.mallet.util.tools.ConvertBytes.toChar ( final byte[]  _char,
final int  _offset,
int  _length 
) [static]
static double com.linxonline.mallet.util.tools.ConvertBytes.toDouble ( final byte[]  _double,
final int  _offset,
int  _length 
) [static]
static float com.linxonline.mallet.util.tools.ConvertBytes.toFloat ( final byte[]  _float,
final int  _offset,
int  _length 
) [static]
static int com.linxonline.mallet.util.tools.ConvertBytes.toInt ( final byte[]  _int,
final int  _offset,
int  _length 
) [static]

BYTE ARRAY to VARIABLE

static int com.linxonline.mallet.util.tools.ConvertBytes.toInteger ( final byte[]  _bytes) [static]

OLD CONVERSION FUNCTIONS - SHOULD BE DEPRECATED Requires at length 4 bytes

static long com.linxonline.mallet.util.tools.ConvertBytes.toLong ( final byte[]  _long,
final int  _offset,
int  _length 
) [static]
static short com.linxonline.mallet.util.tools.ConvertBytes.toShort ( final byte[]  _short,
final int  _offset,
int  _length 
) [static]
static short com.linxonline.mallet.util.tools.ConvertBytes.toShort ( final byte[]  _bytes) [static]

Requires at length 2 bytes

static short [] com.linxonline.mallet.util.tools.ConvertBytes.toShorts ( final byte[]  _bytes) [static]

Member Data Documentation


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables