com.teraspaces.qwframework
Class QWBitConverter

java.lang.Object
  extended by com.teraspaces.qwframework.QWBitConverter

public final class QWBitConverter
extends Object

Helper functions used by QWFIX internally.


Constructor Summary
QWBitConverter()
           
 
Method Summary
static void copyBytes(int value, byte[] buffer, int startIndex)
          Converts a value into byte stream.
static void copyBytes(long value, byte[] buffer, int startIndex)
          Converts a value into byte stream.
static void copyBytes(short valueShort, byte[] buffer, int startIndex)
          Converts a value into byte stream.
static int toInt(byte[] buffer, int startIndex)
          Converts a value into byte stream.
static long toLong(byte[] buffer, int startIndex)
          Converts a value into byte stream.
static short toShort(byte[] buffer, int startIndex)
          Converts a byte stream into value.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QWBitConverter

public QWBitConverter()
Method Detail

copyBytes

public static void copyBytes(short valueShort,
                             byte[] buffer,
                             int startIndex)
Converts a value into byte stream.

Little-endian(as in native x86) is used. Note Java uses big-endian internally.

Parameters:
valueShort - the short value
buffer - the buffer
startIndex - the start index

copyBytes

public static void copyBytes(int value,
                             byte[] buffer,
                             int startIndex)
Converts a value into byte stream.

Little-endian(as in native x86) is used. Note Java uses big-endian internally.

Parameters:
value - the value
buffer - the buffer
startIndex - the start index

copyBytes

public static void copyBytes(long value,
                             byte[] buffer,
                             int startIndex)
Converts a value into byte stream.

Little-endian(as in native x86) is used. Note Java uses big-endian internally.

Parameters:
value - the value
buffer - the buffer
startIndex - the start index

toShort

public static short toShort(byte[] buffer,
                            int startIndex)
Converts a byte stream into value.

Little-endian(as in native x86) is used. Note Java uses big-endian internally.

Parameters:
buffer - the buffer
startIndex - the start index
Returns:
the short value

toInt

public static int toInt(byte[] buffer,
                        int startIndex)
Converts a value into byte stream.

Little-endian(as in native x86) is used. Note Java uses big-endian internally.

Parameters:
buffer - the buffer
startIndex - the start index
Returns:
the integer value

toLong

public static long toLong(byte[] buffer,
                          int startIndex)
Converts a value into byte stream.

Little-endian(as in native x86) is used. Note Java uses big-endian internally.

Parameters:
buffer - the buffer
startIndex - the start index
Returns:
the long valie