edu.sdsc.grid.io
Class Host

java.lang.Object
  extended by edu.sdsc.grid.io.Host

public final class Host
extends java.lang.Object

The Host class describes important attributes of the current host processor, compiler, and operating system. Attributes include:

All methods and fields of this class are static. Object instances of this class cannot be created.

Attributes

Byte order
For all data types requiring more than one byte (i.e., sizeof(type)>1), the processor stores the value as a sequence of bytes. That sequence may place the highest-order bytes first or last:

Intel processors are LBF, while most other processors are MBF. Java is always MBF, regardless of processor.

Data type storage sizes
Java defines fixed values, independent of processor, for the storage size of each primitive type.

Data type significant bits
The significant bits of a data type are the bits that may be set when using a value of that type. In Java this is the same number of bits as used to store that type.

Data type storage alignment
Storage alignment forces data types to start on half-word, word, or double-word address boundaries (depending on the type). This data cannot be determined, or used, in Java applications.

methods

Cast methods
Methods named "castToType" where "Type" is "Short," "Int", etc., provide a smart method of casting bytes from a raw byte array into a data type's value. For instance, if an array "bytes" contains a 4-byte float, then use:
float value = Host.castToFloat( bytes );

Copy methods
Methods named "copyType" where "Type" is "Short," "Int," etc., provide a smart method of copying a data typed value into a raw byte array. For instance, if a 4-byte float value needs to be copied into the next 4 bytes in a "bytes" array, then use:

Host.copyFloat( value, bytes );
Sub-classing
Final
Thread safe
Yes


Field Summary
static int CHAR
          A language primitive signed or unsigned char.
static int DOUBLE
          A language primitive double.
static int FLOAT
          A language primitive float.
static int INT
          A language primitive signed or unsigned integer.
static int LONG
          A language primitive signed or unsigned long integer.
static int LONGDOUBLE
          A language primitive long double.
static int LONGLONG
          A language primitive signed or unsigned long long integer.
static int MAX_TYPE_SIZE
          The guaranteed maximum number of bytes ever needed to hold the largest data type.
static int NUMBER_TYPES
          The number of language primitive types.
static int SHORT
          A language primitive signed or unsigned short integer.
 
Constructor Summary
Host()
           
 
Method Summary
static short castToByte(byte[] bytes)
          Casts bytes from the given byte array into a value of the type and returns it.
static short castToByte(byte[] bytes, int offset)
          Casts bytes from the given byte array into a value of the type and returns it.
static double castToDouble(byte[] bytes)
          Casts bytes from the given byte array into a value of the type and returns it.
static double castToDouble(byte[] bytes, int offset)
          Casts bytes from the given byte array into a value of the type and returns it.
static float castToFloat(byte[] bytes)
          Casts bytes from the given byte array into a value of the type and returns it.
static float castToFloat(byte[] bytes, int offset)
          Casts bytes from the given byte array into a value of the type and returns it.
static int castToInt(byte[] bytes)
          Casts bytes from the given byte array into a value of the type and returns it.
static int castToInt(byte[] bytes, int offset)
          Casts bytes from the given byte array into a value of the type and returns it.
static long castToLong(byte[] bytes)
          Casts bytes from the given byte array into a value of the type and returns it.
static long castToLong(byte[] bytes, int offset)
          Casts bytes from the given byte array into a value of the type and returns it.
static double castToLongDouble(byte[] bytes)
          Casts bytes from the given byte array into a value of the type and returns it.
static double castToLongDouble(byte[] bytes, int offset)
          Casts bytes from the given byte array into a value of the type and returns it.
static long castToLongLong(byte[] bytes)
          Casts bytes from the given byte array into a value of the type and returns it.
static long castToLongLong(byte[] bytes, int offset)
          Casts bytes from the given byte array into a value of the type and returns it.
static short castToShort(byte[] bytes)
          Casts bytes from the given byte array into a value of the type and returns it.
static short castToShort(byte[] bytes, int offset)
          Casts bytes from the given byte array into a value of the type and returns it.
static long castToUnsignedInt(byte[] bytes)
          Casts bytes from the given byte array into a value of the type and returns it.
static long castToUnsignedInt(byte[] bytes, int offset)
          Casts bytes from the given byte array into a value of the type and returns it.
static long castToUnsignedLong(byte[] bytes)
          Casts bytes from the given byte array into a value of the type and returns it.
static long castToUnsignedLong(byte[] bytes, int offset)
          Casts bytes from the given byte array into a value of the type and returns it.
static long castToUnsignedLongLong(byte[] bytes)
          Casts bytes from the given byte array into a value of the type and returns it.
static long castToUnsignedLongLong(byte[] bytes, int offset)
          Casts bytes from the given byte array into a value of the type and returns it.
static int castToUnsignedShort(byte[] bytes)
          Casts bytes from the given byte array into a value of the type and returns it.
static int castToUnsignedShort(byte[] bytes, int offset)
          Casts bytes from the given byte array into a value of the type and returns it.
static void copyDouble(double value, byte[] bytes)
          Copies the given value of the type into the given byte array.
static void copyDouble(double value, byte[] bytes, int offset)
          Copies the given value of the type into the given byte array.
static void copyFloat(double value, byte[] bytes)
          Copies the given value of the type into the given byte array.
static void copyFloat(double value, byte[] bytes, int offset)
          Copies the given value of the type into the given byte array.
static void copyFloat(float value, byte[] bytes)
          Copies the given value of the type into the given byte array.
static void copyFloat(float value, byte[] bytes, int offset)
          Copies the given value of the type into the given byte array.
static void copyInt(byte value, byte[] bytes)
          Copies the given value of the type into the given byte array.
static void copyInt(byte value, byte[] bytes, int offset)
          Copies the given value of the type into the given byte array.
static void copyInt(int value, byte[] bytes)
          Copies the given value of the type into the given byte array.
static void copyInt(int value, byte[] bytes, int offset)
          Copies the given value of the type into the given byte array.
static void copyInt(long value, byte[] bytes)
          Copies the given value of the type into the given byte array.
static void copyInt(long value, byte[] bytes, int offset)
          Copies the given value of the type into the given byte array.
static void copyInt(short value, byte[] bytes)
          Copies the given value of the type into the given byte array.
static void copyInt(short value, byte[] bytes, int offset)
          Copies the given value of the type into the given byte array.
static void copyLong(byte value, byte[] bytes)
          Copies the given value of the type into the given byte array.
static void copyLong(byte value, byte[] bytes, int offset)
          Copies the given value of the type into the given byte array.
static void copyLong(int value, byte[] bytes)
          Copies the given value of the type into the given byte array.
static void copyLong(int value, byte[] bytes, int offset)
          Copies the given value of the type into the given byte array.
static void copyLong(long value, byte[] bytes)
          Copies the given value of the type into the given byte array.
static void copyLong(long value, byte[] bytes, int offset)
          Copies the given value of the type into the given byte array.
static void copyLong(short value, byte[] bytes)
          Copies the given value of the type into the given byte array.
static void copyLong(short value, byte[] bytes, int offset)
          Copies the given value of the type into the given byte array.
static void copyLongDouble(double value, byte[] bytes)
          Copies the given value of the type into the given byte array.
static void copyLongDouble(double value, byte[] bytes, int offset)
          Copies the given value of the type into the given byte array.
static void copyLongLong(byte value, byte[] bytes)
          Copies the given value of the type into the given byte array.
static void copyLongLong(byte value, byte[] bytes, int offset)
          Copies the given value of the type into the given byte array.
static void copyLongLong(int value, byte[] bytes)
          Copies the given value of the type into the given byte array.
static void copyLongLong(int value, byte[] bytes, int offset)
          Copies the given value of the type into the given byte array.
static void copyLongLong(long value, byte[] bytes)
          Copies the given value of the type into the given byte array.
static void copyLongLong(long value, byte[] bytes, int offset)
          Copies the given value of the type into the given byte array.
static void copyLongLong(short value, byte[] bytes)
          Copies the given value of the type into the given byte array.
static void copyLongLong(short value, byte[] bytes, int offset)
          Copies the given value of the type into the given byte array.
static void copyShort(byte value, byte[] bytes)
          Copies the given value of the type into the given byte array.
static void copyShort(byte value, byte[] bytes, int offset)
          Copies the given value of the type into the given byte array.
static void copyShort(int value, byte[] bytes)
          Copies the given value of the type into the given byte array.
static void copyShort(int value, byte[] bytes, int offset)
          Copies the given value of the type into the given byte array.
static void copyShort(long value, byte[] bytes)
          Copies the given value of the type into the given byte array.
static void copyShort(long value, byte[] bytes, int offset)
          Copies the given value of the type into the given byte array.
static void copyShort(short value, byte[] bytes)
          Copies the given value of the type into the given byte array.
static void copyShort(short value, byte[] bytes, int offset)
          Copies the given value of the type into the given byte array.
static void copyUnsignedInt(byte value, byte[] bytes)
          Copies the given value of the type into the given byte array.
static void copyUnsignedInt(byte value, byte[] bytes, int offset)
          Copies the given value of the type into the given byte array.
static void copyUnsignedInt(int value, byte[] bytes)
          Copies the given value of the type into the given byte array.
static void copyUnsignedInt(int value, byte[] bytes, int offset)
          Copies the given value of the type into the given byte array.
static void copyUnsignedInt(long value, byte[] bytes)
          Copies the given value of the type into the given byte array.
static void copyUnsignedInt(long value, byte[] bytes, int offset)
          Copies the given value of the type into the given byte array.
static void copyUnsignedInt(short value, byte[] bytes)
          Copies the given value of the type into the given byte array.
static void copyUnsignedInt(short value, byte[] bytes, int offset)
          Copies the given value of the type into the given byte array.
static void copyUnsignedLong(byte value, byte[] bytes)
          Copies the given value of the type into the given byte array.
static void copyUnsignedLong(byte value, byte[] bytes, int offset)
          Copies the given value of the type into the given byte array.
static void copyUnsignedLong(int value, byte[] bytes)
          Copies the given value of the type into the given byte array.
static void copyUnsignedLong(int value, byte[] bytes, int offset)
          Copies the given value of the type into the given byte array.
static void copyUnsignedLong(long value, byte[] bytes)
          Copies the given value of the type into the given byte array.
static void copyUnsignedLong(long value, byte[] bytes, int offset)
          Copies the given value of the type into the given byte array.
static void copyUnsignedLong(short value, byte[] bytes)
          Copies the given value of the type into the given byte array.
static void copyUnsignedLong(short value, byte[] bytes, int offset)
          Copies the given value of the type into the given byte array.
static void copyUnsignedLongLong(byte value, byte[] bytes)
          Copies the given value of the type into the given byte array.
static void copyUnsignedLongLong(byte value, byte[] bytes, int offset)
          Copies the given value of the type into the given byte array.
static void copyUnsignedLongLong(int value, byte[] bytes)
          Copies the given value of the type into the given byte array.
static void copyUnsignedLongLong(int value, byte[] bytes, int offset)
          Copies the given value of the type into the given byte array.
static void copyUnsignedLongLong(long value, byte[] bytes)
          Copies the given value of the type into the given byte array.
static void copyUnsignedLongLong(long value, byte[] bytes, int offset)
          Copies the given value of the type into the given byte array.
static void copyUnsignedLongLong(short value, byte[] bytes)
          Copies the given value of the type into the given byte array.
static void copyUnsignedLongLong(short value, byte[] bytes, int offset)
          Copies the given value of the type into the given byte array.
static void copyUnsignedShort(byte value, byte[] bytes)
          Copies the given value of the type into the given byte array.
static void copyUnsignedShort(byte value, byte[] bytes, int offset)
          Copies the given value of the type into the given byte array.
static void copyUnsignedShort(int value, byte[] bytes)
          Copies the given value of the type into the given byte array.
static void copyUnsignedShort(int value, byte[] bytes, int offset)
          Copies the given value of the type into the given byte array.
static void copyUnsignedShort(long value, byte[] bytes)
          Copies the given value of the type into the given byte array.
static void copyUnsignedShort(long value, byte[] bytes, int offset)
          Copies the given value of the type into the given byte array.
static void copyUnsignedShort(short value, byte[] bytes)
          Copies the given value of the type into the given byte array.
static void copyUnsignedShort(short value, byte[] bytes, int offset)
          Copies the given value of the type into the given byte array.
static int getCompilerAlignment(int type)
          Gets the alignment boundary, in bytes, imposed by the compiler for the type.
static java.lang.String getName(int type)
          Gets the name of the type.
static int getSignificantBits(int type)
          Gets the number of significant bits of the type.
static byte getStorageSize(int type)
          Gets the number of bytes occupied by the type.
static boolean isLBFByteOrder()
          Returns true if the host's byte order is "little endian" or Least-significant-Byte-First (LBF); otherwise false.
static boolean isMBFByteOrder()
          Returns true if the host's byte order is "big endian" or Most-significant-Byte-First (MBF); otherwise false.
static void print()
          Prints to System.out the attributes of the current host.
static void swap(byte[] bytes, int nBytes)
          Reverses the byte order of the first nBytes of the byte array.
static void swap(byte[] bytes, int offset, int nBytes)
          Reverses the byte order of nBytes of the byte array, starting at the given offset.
static void swapMultiple(byte[] bytes, int nBytes, int nTimes)
          Reverses the byte order of nBytes of the byte array, doing it nTimes in a row for consecutive runs of nBytes.
static void swapMultiple(byte[] bytes, int offset, int nBytes, int nTimes)
          Reverses the byte order of nBytes of the byte array, starting at the given offset, and doing it nTimes in a row for consecutive runs of nBytes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CHAR

public static final int CHAR
A language primitive signed or unsigned char.

See Also:
Constant Field Values

SHORT

public static final int SHORT
A language primitive signed or unsigned short integer.

See Also:
Constant Field Values

INT

public static final int INT
A language primitive signed or unsigned integer.

See Also:
Constant Field Values

LONG

public static final int LONG
A language primitive signed or unsigned long integer.

See Also:
Constant Field Values

LONGLONG

public static final int LONGLONG
A language primitive signed or unsigned long long integer.

See Also:
Constant Field Values

FLOAT

public static final int FLOAT
A language primitive float.

See Also:
Constant Field Values

DOUBLE

public static final int DOUBLE
A language primitive double.

See Also:
Constant Field Values

LONGDOUBLE

public static final int LONGDOUBLE
A language primitive long double.

See Also:
Constant Field Values

NUMBER_TYPES

public static final int NUMBER_TYPES
The number of language primitive types.

See Also:
Constant Field Values

MAX_TYPE_SIZE

public static final int MAX_TYPE_SIZE
The guaranteed maximum number of bytes ever needed to hold the largest data type. This value may used to pre-allocate byte arrays used for read, writing, and byte-flipping values of any primitive data type.

The maximum value is intentionally set large in order to accomodate current and future architectures.

See Also:
Constant Field Values
Constructor Detail

Host

public Host()
Method Detail

isMBFByteOrder

public static final boolean isMBFByteOrder()
Returns true if the host's byte order is "big endian" or Most-significant-Byte-First (MBF); otherwise false.

Returns:
true if MBF; false if LBF

isLBFByteOrder

public static final boolean isLBFByteOrder()
Returns true if the host's byte order is "little endian" or Least-significant-Byte-First (LBF); otherwise false.

Returns:
true if LBF; false if MBF

getName

public static final java.lang.String getName(int type)
Gets the name of the type.

Parameters:
type - the type code for the data type
Returns:
the type name

getStorageSize

public static final byte getStorageSize(int type)
Gets the number of bytes occupied by the type.

Parameters:
type - the type code for the data type
Returns:
the number of bytes

getSignificantBits

public static final int getSignificantBits(int type)
Gets the number of significant bits of the type.

Parameters:
type - the type code for the data type
Returns:
the number of bytes

getCompilerAlignment

public static final int getCompilerAlignment(int type)
Gets the alignment boundary, in bytes, imposed by the compiler for the type.

Parameters:
type - the type code for the data type
Returns:
the alignment in bytes

swap

public static final void swap(byte[] bytes,
                              int nBytes)
Reverses the byte order of the first nBytes of the byte array. This method can be used to convert a byte array from Most- to Least-significant-Byte-First, or vice versa.

The swap is done in-place, reversing the order of bytes in the given array.

Parameters:
bytes - an array of bytes to swap the order of
nBytes - the number of bytes to swap

swap

public static final void swap(byte[] bytes,
                              int offset,
                              int nBytes)
Reverses the byte order of nBytes of the byte array, starting at the given offset. This method can be used to convert a byte array from Most- to Least-significant-Byte-First, or vice versa.

The swap is done in-place, reversing the order of bytes in the given array.

Parameters:
bytes - an array of bytes to swap the order of
offset - the starting point in the bytes array
nBytes - the number of bytes to swap

swapMultiple

public static final void swapMultiple(byte[] bytes,
                                      int nBytes,
                                      int nTimes)
Reverses the byte order of nBytes of the byte array, doing it nTimes in a row for consecutive runs of nBytes. This method can be used to convert a byte array containing multiple values, swaping each one from Most- to Least-significant-Byte-First, or vice versa.

The swap is done in-place, reversing the order of bytes in the given array.

Parameters:
bytes - an array of bytes to swap the order of
nBytes - the number of bytes to swap
nTimes - the number of times to do consecutive swaps

swapMultiple

public static final void swapMultiple(byte[] bytes,
                                      int offset,
                                      int nBytes,
                                      int nTimes)
Reverses the byte order of nBytes of the byte array, starting at the given offset, and doing it nTimes in a row for consecutive runs of nBytes. This method can be used to convert a byte array containing multiple values, swaping each one from Most- to Least-significant-Byte-First, or vice versa.

The swap is done in-place, reversing the order of bytes in the given array.

Parameters:
bytes - an array of bytes to swap the order of
offset - starting point in the array
nBytes - the number of bytes to swap
nTimes - the number of times to do consecutive swaps

castToByte

public static final short castToByte(byte[] bytes)
Casts bytes from the given byte array into a value of the type and returns it. The bytes in the array need not be aligned appropriately for the type. The array is assumed to contain a legal value for the type with sizeof(type) bytes in the Java byte order.

Because Java doesn't support unsigned primitive types, this method returns the value in the next larger data type, with the high bits set to zeroes.

Parameters:
bytes - byte array
Returns:
the unsigned byte value (as an short)

castToShort

public static final short castToShort(byte[] bytes)
Casts bytes from the given byte array into a value of the type and returns it. The bytes in the array need not be aligned appropriately for the type. The array is assumed to contain a legal value for the type with sizeof(type) bytes in the Java byte order.

Parameters:
bytes - byte array
Returns:
the short value

castToUnsignedShort

public static final int castToUnsignedShort(byte[] bytes)
Casts bytes from the given byte array into a value of the type and returns it. The bytes in the array need not be aligned appropriately for the type. The array is assumed to contain a legal value for the type with sizeof(type) bytes in the Java byte order.

Because Java doesn't support unsigned primitive types, this method returns the value in the next larger data type, with the high bits set to zeroes.

Parameters:
bytes - byte array
Returns:
the unsigned short value (as an int)

castToInt

public static final int castToInt(byte[] bytes)
Casts bytes from the given byte array into a value of the type and returns it. The bytes in the array need not be aligned appropriately for the type. The array is assumed to contain a legal value for the type with sizeof(type) bytes in the Java byte order.

Parameters:
bytes - byte array
Returns:
the int value

castToUnsignedInt

public static final long castToUnsignedInt(byte[] bytes)
Casts bytes from the given byte array into a value of the type and returns it. The bytes in the array need not be aligned appropriately for the type. The array is assumed to contain a legal value for the type with sizeof(type) bytes in the Java byte order.

Because Java doesn't support unsigned primitive types, this method returns the value in the next larger data type, with the high bits set to zeroes.

Parameters:
bytes - byte array
Returns:
the unsigned int value (as a long)

castToLong

public static final long castToLong(byte[] bytes)
Casts bytes from the given byte array into a value of the type and returns it. The bytes in the array need not be aligned appropriately for the type. The array is assumed to contain a legal value for the type with sizeof(type) bytes in the Java byte order.

Parameters:
bytes - byte array
Returns:
the long value

castToUnsignedLong

public static final long castToUnsignedLong(byte[] bytes)
Casts bytes from the given byte array into a value of the type and returns it. The bytes in the array need not be aligned appropriately for the type. The array is assumed to contain a legal value for the type with sizeof(type) bytes in the Java byte order.

Parameters:
bytes - byte array
Returns:
the unsigned long value

castToLongLong

public static final long castToLongLong(byte[] bytes)
Casts bytes from the given byte array into a value of the type and returns it. The bytes in the array need not be aligned appropriately for the type. The array is assumed to contain a legal value for the type with sizeof(type) bytes in the Java byte order.

Note: Since Java does not support long long types, this method is identical to the long version.

Parameters:
bytes - byte array
Returns:
the long long value

castToUnsignedLongLong

public static final long castToUnsignedLongLong(byte[] bytes)
Casts bytes from the given byte array into a value of the type and returns it. The bytes in the array need not be aligned appropriately for the type. The array is assumed to contain a legal value for the type with sizeof(type) bytes in the Java byte order.

Note: Since Java does not support long long types, this method is identical to the long version.

Parameters:
bytes - byte array
Returns:
the unsigned long long value

castToFloat

public static final float castToFloat(byte[] bytes)
Casts bytes from the given byte array into a value of the type and returns it. The bytes in the array need not be aligned appropriately for the type. The array is assumed to contain a legal value for the type with sizeof(type) bytes in the Java byte order.

Parameters:
bytes - byte array
Returns:
the float value

castToDouble

public static final double castToDouble(byte[] bytes)
Casts bytes from the given byte array into a value of the type and returns it. The bytes in the array need not be aligned appropriately for the type. The array is assumed to contain a legal value for the type with sizeof(type) bytes in the Java byte order.

Parameters:
bytes - byte array
Returns:
the double value

castToLongDouble

public static final double castToLongDouble(byte[] bytes)
Casts bytes from the given byte array into a value of the type and returns it. The bytes in the array need not be aligned appropriately for the type. The array is assumed to contain a legal value for the type with sizeof(type) bytes in the Java byte order.

Note: Since Java does not support long double types, this method is identical to the double version.

Parameters:
bytes - byte array
Returns:
the long double value

castToByte

public static final short castToByte(byte[] bytes,
                                     int offset)
Casts bytes from the given byte array into a value of the type and returns it. The bytes in the array need not be aligned appropriately for the type. The array is assumed to contain a legal value for the type with sizeof(type) bytes in the Java byte order.

Because Java doesn't support unsigned primitive types, this method returns the value in the next larger data type, with the high bits set to zeroes.

Parameters:
bytes - byte array
offset - starting point in byte array
Returns:
the unsigned byte value (as a short)

castToShort

public static final short castToShort(byte[] bytes,
                                      int offset)
Casts bytes from the given byte array into a value of the type and returns it. The bytes in the array need not be aligned appropriately for the type. The array is assumed to contain a legal value for the type with sizeof(type) bytes in the Java byte order.

Parameters:
bytes - byte array
offset - starting point in byte array
Returns:
the short value

castToUnsignedShort

public static final int castToUnsignedShort(byte[] bytes,
                                            int offset)
Casts bytes from the given byte array into a value of the type and returns it. The bytes in the array need not be aligned appropriately for the type. The array is assumed to contain a legal value for the type with sizeof(type) bytes in the Java byte order.

Because Java doesn't support unsigned primitive types, this method returns the value in the next larger data type, with the high bits set to zeroes.

Parameters:
bytes - byte array
offset - starting point in byte array
Returns:
the unsigned short value (as an int)

castToInt

public static final int castToInt(byte[] bytes,
                                  int offset)
Casts bytes from the given byte array into a value of the type and returns it. The bytes in the array need not be aligned appropriately for the type. The array is assumed to contain a legal value for the type with sizeof(type) bytes in the Java byte order.

Parameters:
bytes - byte array
offset - starting point in byte array
Returns:
the int value

castToUnsignedInt

public static final long castToUnsignedInt(byte[] bytes,
                                           int offset)
Casts bytes from the given byte array into a value of the type and returns it. The bytes in the array need not be aligned appropriately for the type. The array is assumed to contain a legal value for the type with sizeof(type) bytes in the Java byte order.

Because Java doesn't support unsigned primitive types, this method returns the value in the next larger data type, with the high bits set to zeroes.

Parameters:
bytes - byte array
offset - starting point in byte array
Returns:
the unsigned int value (as a long)

castToLong

public static final long castToLong(byte[] bytes,
                                    int offset)
Casts bytes from the given byte array into a value of the type and returns it. The bytes in the array need not be aligned appropriately for the type. The array is assumed to contain a legal value for the type with sizeof(type) bytes in the Java byte order.

Parameters:
bytes - byte array
offset - starting point in byte array
Returns:
the long value

castToUnsignedLong

public static final long castToUnsignedLong(byte[] bytes,
                                            int offset)
Casts bytes from the given byte array into a value of the type and returns it. The bytes in the array need not be aligned appropriately for the type. The array is assumed to contain a legal value for the type with sizeof(type) bytes in the Java byte order.

Parameters:
bytes - byte array
offset - starting point in byte array
Returns:
the unsigned long value

castToLongLong

public static final long castToLongLong(byte[] bytes,
                                        int offset)
Casts bytes from the given byte array into a value of the type and returns it. The bytes in the array need not be aligned appropriately for the type. The array is assumed to contain a legal value for the type with sizeof(type) bytes in the Java byte order.

Note: Since Java does not support long long types, this method is identical to the long version.

Parameters:
bytes - byte array
offset - starting point in byte array
Returns:
the long long value

castToUnsignedLongLong

public static final long castToUnsignedLongLong(byte[] bytes,
                                                int offset)
Casts bytes from the given byte array into a value of the type and returns it. The bytes in the array need not be aligned appropriately for the type. The array is assumed to contain a legal value for the type with sizeof(type) bytes in the Java byte order.

Note: Since Java does not support long long types, this method is identical to the long version.

Parameters:
bytes - byte array
offset - starting point in byte array
Returns:
the unsigned long long value

castToFloat

public static final float castToFloat(byte[] bytes,
                                      int offset)
Casts bytes from the given byte array into a value of the type and returns it. The bytes in the array need not be aligned appropriately for the type. The array is assumed to contain a legal value for the type with sizeof(type) bytes in the Java byte order.

Parameters:
bytes - byte array
offset - starting point in byte array
Returns:
the float value

castToDouble

public static final double castToDouble(byte[] bytes,
                                        int offset)
Casts bytes from the given byte array into a value of the type and returns it. The bytes in the array need not be aligned appropriately for the type. The array is assumed to contain a legal value for the type with sizeof(type) bytes in the Java byte order.

Parameters:
bytes - byte array
offset - starting point in byte array
Returns:
the double value

castToLongDouble

public static final double castToLongDouble(byte[] bytes,
                                            int offset)
Casts bytes from the given byte array into a value of the type and returns it. The bytes in the array need not be aligned appropriately for the type. The array is assumed to contain a legal value for the type with sizeof(type) bytes in the Java byte order.

Note: Since Java does not support long double types, this method is identical to the double version.

Parameters:
bytes - byte array
offset - starting point in byte array
Returns:
the long double value

copyShort

public static final void copyShort(byte value,
                                   byte[] bytes)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Parameters:
value - the value to copy
bytes - byte array to receive value

copyShort

public static final void copyShort(short value,
                                   byte[] bytes)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Parameters:
value - the value to copy
bytes - byte array to receive value

copyShort

public static final void copyShort(int value,
                                   byte[] bytes)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Parameters:
value - the value to copy
bytes - byte array to receive value

copyShort

public static final void copyShort(long value,
                                   byte[] bytes)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Parameters:
value - the value to copy
bytes - byte array to receive value

copyUnsignedShort

public static final void copyUnsignedShort(byte value,
                                           byte[] bytes)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Parameters:
value - the value to copy
bytes - byte array to receive value

copyUnsignedShort

public static final void copyUnsignedShort(short value,
                                           byte[] bytes)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Parameters:
value - the value to copy
bytes - byte array to receive value

copyUnsignedShort

public static final void copyUnsignedShort(int value,
                                           byte[] bytes)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Parameters:
value - the value to copy
bytes - byte array to receive value

copyUnsignedShort

public static final void copyUnsignedShort(long value,
                                           byte[] bytes)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Parameters:
value - the value to copy
bytes - byte array to receive value

copyInt

public static final void copyInt(byte value,
                                 byte[] bytes)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Parameters:
value - the value to copy
bytes - byte array to receive value

copyInt

public static final void copyInt(short value,
                                 byte[] bytes)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Parameters:
value - the value to copy
bytes - byte array to receive value

copyInt

public static final void copyInt(int value,
                                 byte[] bytes)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Parameters:
value - the value to copy
bytes - byte array to receive value

copyInt

public static final void copyInt(long value,
                                 byte[] bytes)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Parameters:
value - the value to copy
bytes - byte array to receive value

copyUnsignedInt

public static final void copyUnsignedInt(byte value,
                                         byte[] bytes)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Parameters:
value - the value to copy
bytes - byte array to receive value

copyUnsignedInt

public static final void copyUnsignedInt(short value,
                                         byte[] bytes)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Parameters:
value - the value to copy
bytes - byte array to receive value

copyUnsignedInt

public static final void copyUnsignedInt(int value,
                                         byte[] bytes)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Parameters:
value - the value to copy
bytes - byte array to receive value

copyUnsignedInt

public static final void copyUnsignedInt(long value,
                                         byte[] bytes)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Parameters:
value - the value to copy
bytes - byte array to receive value

copyLong

public static final void copyLong(byte value,
                                  byte[] bytes)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Parameters:
value - the value to copy
bytes - byte array to receive value

copyLong

public static final void copyLong(short value,
                                  byte[] bytes)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Parameters:
value - the value to copy
bytes - byte array to receive value

copyLong

public static final void copyLong(int value,
                                  byte[] bytes)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Parameters:
value - the value to copy
bytes - byte array to receive value

copyLong

public static final void copyLong(long value,
                                  byte[] bytes)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Parameters:
value - the value to copy
bytes - byte array to receive value

copyUnsignedLong

public static final void copyUnsignedLong(byte value,
                                          byte[] bytes)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Parameters:
value - the value to copy
bytes - byte array to receive value

copyUnsignedLong

public static final void copyUnsignedLong(short value,
                                          byte[] bytes)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Parameters:
value - the value to copy
bytes - byte array to receive value

copyUnsignedLong

public static final void copyUnsignedLong(int value,
                                          byte[] bytes)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Parameters:
value - the value to copy
bytes - byte array to receive value

copyUnsignedLong

public static final void copyUnsignedLong(long value,
                                          byte[] bytes)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Parameters:
value - the value to copy
bytes - byte array to receive value

copyLongLong

public static final void copyLongLong(byte value,
                                      byte[] bytes)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Note: Since Java does not support long long types, this method is identical to the long version.

Parameters:
value - the value to copy
bytes - byte array to receive value

copyLongLong

public static final void copyLongLong(short value,
                                      byte[] bytes)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Note: Since Java does not support long long types, this method is identical to the long version.

Parameters:
value - the value to copy
bytes - byte array to receive value

copyLongLong

public static final void copyLongLong(int value,
                                      byte[] bytes)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Note: Since Java does not support long long types, this method is identical to the long version.

Parameters:
value - the value to copy
bytes - byte array to receive value

copyLongLong

public static final void copyLongLong(long value,
                                      byte[] bytes)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Note: Since Java does not support long long types, this method is identical to the long version.

Parameters:
value - the value to copy
bytes - byte array to receive value

copyUnsignedLongLong

public static final void copyUnsignedLongLong(byte value,
                                              byte[] bytes)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Note: Since Java does not support long long types, this method is identical to the long version.

Parameters:
value - the value to copy
bytes - byte array to receive value

copyUnsignedLongLong

public static final void copyUnsignedLongLong(short value,
                                              byte[] bytes)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Note: Since Java does not support long long types, this method is identical to the long version.

Parameters:
value - the value to copy
bytes - byte array to receive value

copyUnsignedLongLong

public static final void copyUnsignedLongLong(int value,
                                              byte[] bytes)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Note: Since Java does not support long long types, this method is identical to the long version.

Parameters:
value - the value to copy
bytes - byte array to receive value

copyUnsignedLongLong

public static final void copyUnsignedLongLong(long value,
                                              byte[] bytes)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Note: Since Java does not support long long types, this method is identical to the long version.

Parameters:
value - the value to copy
bytes - byte array to receive value

copyFloat

public static final void copyFloat(float value,
                                   byte[] bytes)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Parameters:
value - the value to copy
bytes - byte array to receive value

copyFloat

public static final void copyFloat(double value,
                                   byte[] bytes)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Parameters:
value - the value to copy
bytes - byte array to receive value

copyDouble

public static final void copyDouble(double value,
                                    byte[] bytes)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Parameters:
value - the value to copy
bytes - byte array to receive value

copyLongDouble

public static final void copyLongDouble(double value,
                                        byte[] bytes)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Note: Since Java does not support long double types, this method is identical to the double version.

Parameters:
value - the value to copy
bytes - byte array to receive value

copyShort

public static final void copyShort(byte value,
                                   byte[] bytes,
                                   int offset)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Parameters:
value - the value to copy
bytes - byte array to receive value
offset - starting point in array

copyShort

public static final void copyShort(short value,
                                   byte[] bytes,
                                   int offset)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Parameters:
value - the value to copy
bytes - byte array to receive value
offset - starting point in array

copyShort

public static final void copyShort(int value,
                                   byte[] bytes,
                                   int offset)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Parameters:
value - the value to copy
bytes - byte array to receive value
offset - starting point in array

copyShort

public static final void copyShort(long value,
                                   byte[] bytes,
                                   int offset)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Parameters:
value - the value to copy
bytes - byte array to receive value
offset - starting point in array

copyUnsignedShort

public static final void copyUnsignedShort(byte value,
                                           byte[] bytes,
                                           int offset)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Parameters:
value - the value to copy
bytes - byte array to receive value
offset - starting point in array

copyUnsignedShort

public static final void copyUnsignedShort(short value,
                                           byte[] bytes,
                                           int offset)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Parameters:
value - the value to copy
bytes - byte array to receive value
offset - starting point in array

copyUnsignedShort

public static final void copyUnsignedShort(int value,
                                           byte[] bytes,
                                           int offset)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Parameters:
value - the value to copy
bytes - byte array to receive value
offset - starting point in array

copyUnsignedShort

public static final void copyUnsignedShort(long value,
                                           byte[] bytes,
                                           int offset)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Parameters:
value - the value to copy
bytes - byte array to receive value
offset - starting point in array

copyInt

public static final void copyInt(byte value,
                                 byte[] bytes,
                                 int offset)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Parameters:
value - the value to copy
bytes - byte array to receive value
offset - starting point in array

copyInt

public static final void copyInt(short value,
                                 byte[] bytes,
                                 int offset)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Parameters:
value - the value to copy
bytes - byte array to receive value
offset - starting point in array

copyInt

public static final void copyInt(int value,
                                 byte[] bytes,
                                 int offset)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Parameters:
value - the value to copy
bytes - byte array to receive value
offset - starting point in array

copyInt

public static final void copyInt(long value,
                                 byte[] bytes,
                                 int offset)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Parameters:
value - the value to copy
bytes - byte array to receive value
offset - starting point in array

copyUnsignedInt

public static final void copyUnsignedInt(byte value,
                                         byte[] bytes,
                                         int offset)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Parameters:
value - the value to copy
bytes - byte array to receive value
offset - starting point in array

copyUnsignedInt

public static final void copyUnsignedInt(short value,
                                         byte[] bytes,
                                         int offset)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Parameters:
value - the value to copy
bytes - byte array to receive value
offset - starting point in array

copyUnsignedInt

public static final void copyUnsignedInt(int value,
                                         byte[] bytes,
                                         int offset)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Parameters:
value - the value to copy
bytes - byte array to receive value
offset - starting point in array

copyUnsignedInt

public static final void copyUnsignedInt(long value,
                                         byte[] bytes,
                                         int offset)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Parameters:
value - the value to copy
bytes - byte array to receive value
offset - starting point in array

copyLong

public static final void copyLong(byte value,
                                  byte[] bytes,
                                  int offset)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Parameters:
value - the value to copy
bytes - byte array to receive value
offset - starting point in array

copyLong

public static final void copyLong(short value,
                                  byte[] bytes,
                                  int offset)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Parameters:
value - the value to copy
bytes - byte array to receive value
offset - starting point in array

copyLong

public static final void copyLong(int value,
                                  byte[] bytes,
                                  int offset)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Parameters:
value - the value to copy
bytes - byte array to receive value
offset - starting point in array

copyLong

public static final void copyLong(long value,
                                  byte[] bytes,
                                  int offset)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Parameters:
value - the value to copy
bytes - byte array to receive value
offset - starting point in array

copyUnsignedLong

public static final void copyUnsignedLong(byte value,
                                          byte[] bytes,
                                          int offset)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Parameters:
value - the value to copy
bytes - byte array to receive value
offset - starting point in array

copyUnsignedLong

public static final void copyUnsignedLong(short value,
                                          byte[] bytes,
                                          int offset)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Parameters:
value - the value to copy
bytes - byte array to receive value
offset - starting point in array

copyUnsignedLong

public static final void copyUnsignedLong(int value,
                                          byte[] bytes,
                                          int offset)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Parameters:
value - the value to copy
bytes - byte array to receive value
offset - starting point in array

copyUnsignedLong

public static final void copyUnsignedLong(long value,
                                          byte[] bytes,
                                          int offset)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Parameters:
value - the value to copy
bytes - byte array to receive value
offset - starting point in array

copyLongLong

public static final void copyLongLong(byte value,
                                      byte[] bytes,
                                      int offset)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Note: Since Java does not support long long types, this method is identical to the long version.

Parameters:
value - the value to copy
bytes - byte array to receive value
offset - starting point in array

copyLongLong

public static final void copyLongLong(short value,
                                      byte[] bytes,
                                      int offset)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Note: Since Java does not support long long types, this method is identical to the long version.

Parameters:
value - the value to copy
bytes - byte array to receive value
offset - starting point in array

copyLongLong

public static final void copyLongLong(int value,
                                      byte[] bytes,
                                      int offset)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Note: Since Java does not support long long types, this method is identical to the long version.

Parameters:
value - the value to copy
bytes - byte array to receive value
offset - starting point in array

copyLongLong

public static final void copyLongLong(long value,
                                      byte[] bytes,
                                      int offset)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Note: Since Java does not support long long types, this method is identical to the long version.

Parameters:
value - the value to copy
bytes - byte array to receive value
offset - starting point in array

copyUnsignedLongLong

public static final void copyUnsignedLongLong(byte value,
                                              byte[] bytes,
                                              int offset)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Note: Since Java does not support long long types, this method is identical to the long version.

Parameters:
value - the value to copy
bytes - byte array to receive value
offset - starting point in array

copyUnsignedLongLong

public static final void copyUnsignedLongLong(short value,
                                              byte[] bytes,
                                              int offset)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Note: Since Java does not support long long types, this method is identical to the long version.

Parameters:
value - the value to copy
bytes - byte array to receive value
offset - starting point in array

copyUnsignedLongLong

public static final void copyUnsignedLongLong(int value,
                                              byte[] bytes,
                                              int offset)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Note: Since Java does not support long long types, this method is identical to the long version.

Parameters:
value - the value to copy
bytes - byte array to receive value
offset - starting point in array

copyUnsignedLongLong

public static final void copyUnsignedLongLong(long value,
                                              byte[] bytes,
                                              int offset)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Note: Since Java does not support long long types, this method is identical to the long version.

Parameters:
value - the value to copy
bytes - byte array to receive value
offset - starting point in array

copyFloat

public static final void copyFloat(float value,
                                   byte[] bytes,
                                   int offset)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Parameters:
value - the value to copy
bytes - byte array to receive value
offset - starting point in array

copyFloat

public static final void copyFloat(double value,
                                   byte[] bytes,
                                   int offset)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Parameters:
value - the value to copy
bytes - byte array to receive value
offset - starting point in array

copyDouble

public static final void copyDouble(double value,
                                    byte[] bytes,
                                    int offset)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Parameters:
value - the value to copy
bytes - byte array to receive value
offset - starting point in array

copyLongDouble

public static final void copyLongDouble(double value,
                                        byte[] bytes,
                                        int offset)
Copies the given value of the type into the given byte array. The array is assumed to be large enough to hold a value of sizeof(type) bytes.

Note: Since Java does not support long double types, this method is identical to the double version.

Parameters:
value - the value to copy
bytes - byte array to receive value
offset - starting point in array

print

public static final void print()
Prints to System.out the attributes of the current host.