com.imagero.uio.xform
Class XTransformer

java.lang.Object
  extended bycom.imagero.uio.xform.XTransformer
Direct Known Subclasses:
Transformer

public class XTransformer
extends java.lang.Object

Primitive type conversion, array copying, etc. The difference to Transformer is that XTransformer does not restricted to big and little endiannes. User may read bytes in any order.


Field Summary
protected static int[] POSITIONS_BE
           
protected static int[][] POSITIONS_LE
           
protected static int[] POSITIONS_LE_INT
           
protected static int[] POSITIONS_LE_LONG
           
protected static int[] POSITIONS_LE_SHORT
           
protected static int[] shifts
           
static int TYPE_BE
           
static int TYPE_LE_INT
           
static int TYPE_LE_LONG
           
static int TYPE_LE_SHORT
           
 
Constructor Summary
XTransformer()
           
 
Method Summary
static int byteToChar(byte[] source, int sourceOffset, char[] dest, int destOffset, int[] positions)
           
static int byteToChar(byte[] source, int sourceOffset, int[] positions)
           
static void byteToChar(byte[] source, int sourceOffset, int count, char[] dest, int destOffset, int[] positions)
           
static int byteToDouble(byte[] source, int sourceOffset, double[] dest, int destOffset, int[] positions)
           
static double byteToDouble(byte[] source, int sourceOffset, int[] positions)
           
static void byteToDouble(byte[] source, int sourceOffset, int count, double[] dest, int destOffset, int[] positions)
           
static int byteToFloat(byte[] source, int sourceOffset, float[] dest, int destOffset, int[] positions)
           
static float byteToFloat(byte[] source, int sourceOffset, int[] positions)
           
static void byteToFloat(byte[] source, int sourceOffset, int count, float[] dest, int destOffset, int[] positions)
           
static int byteToInt(byte[] source, int sourceOffset, int[] positions)
           
static int byteToInt(byte[] source, int sourceOffset, int[] dest, int destOffset, int[] positions)
          write int in BIG_ENDIAN order
static void byteToInt(byte[] source, int sourceOffset, int count, int[] dest, int destOffset, int[] positions)
           
static int byteToInt(int bytesInInt, byte[] source, int sourceOffset, int[] dest, int destOffset, int[] positions)
           
static void byteToInt(int bytesInInt, byte[] source, int sourceOffset, int count, int[] dest, int destOffset, int[] positions)
           
static long byteToLong(byte[] source, int sourceOffset, int[] positions)
           
static void byteToLong(byte[] source, int sourceOffset, int count, long[] dest, int destOffset, int[] positions)
           
static int byteToLong(byte[] source, int sourceOffset, long[] dest, int destOffset, int[] positions)
           
static void byteToLong(int bytesInLong, byte[] source, int sourceOffset, int count, long[] dest, int destOffset, int[] positions)
           
static int byteToLong(int bytesInLong, byte[] source, int sourceOffset, long[] dest, int destOffset, int[] positions)
           
static int byteToShort(byte[] source, int sourceOffset, int[] positions)
           
static void byteToShort(byte[] source, int sourceOffset, int count, short[] dest, int destOffset, int[] positions)
           
static int byteToShort(byte[] source, int sourceOffset, short[] dest, int destOffset, int[] positions)
           
static void byteToShort(int bytesInShort, byte[] source, int sourceOffset, int count, short[] dest, int destOffset, int[] positions)
           
static int byteToShort(int bytesInShort, byte[] source, int sourceOffset, short[] dest, int destOffset, int[] positions)
           
static int charToByte(char[] source, int srcOffset, byte[] dest, int destOffset, int[] positions)
           
static void charToByte(char[] source, int srcOffset, int count, byte[] dest, int destOffset, int[] positions)
           
static int charToByte(char v, byte[] dest, int destOffset, int[] positions)
           
static int doubleToByte(double[] source, int srcOffset, byte[] dest, int destOffset, int[] positions)
           
static void doubleToByte(double[] source, int srcOffset, int count, byte[] dest, int destOffset, int[] positions)
           
static int doubleToByte(double d, byte[] dest, int destOffset, int[] positions)
           
static int floatToByte(float[] source, int offset, byte[] dest, int destOffset, int[] positions)
           
static void floatToByte(float[] source, int offset, int count, byte[] dest, int destOffset, int[] positions)
           
static int floatToByte(float f, byte[] dest, int destOffset, int[] positions)
           
static int[] get(int type)
           
static int intToByte(int[] source, int sourceOffset, byte[] dest, int destOffset, int[] positions)
          read int in BIG_ENDIAN order
static void intToByte(int[] source, int srcOffset, int count, byte[] dest, int destOffset, int[] positions)
          convert count ints to bytes (Big Endian)
static int intToByte(int v, byte[] dest, int destOffset, int[] positions)
           
static int longToByte(long[] source, int offset, byte[] dest, int destOffset, int[] positions)
           
static void longToByte(long[] source, int offset, int count, byte[] dest, int destOffset, int[] positions)
           
static int longToByte(long v, byte[] dest, int destOffset, int[] positions)
           
static int shortToByte(short[] source, int offset, byte[] dest, int destOffset, int[] positions)
           
static void shortToByte(short[] source, int offset, int count, byte[] dest, int destOffset, int[] positions)
           
static int shortToByte(short v, byte[] dest, int destOffset, int[] positions)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

shifts

protected static final int[] shifts

POSITIONS_BE

protected static final int[] POSITIONS_BE

POSITIONS_LE_SHORT

protected static final int[] POSITIONS_LE_SHORT

POSITIONS_LE_INT

protected static final int[] POSITIONS_LE_INT

POSITIONS_LE_LONG

protected static final int[] POSITIONS_LE_LONG

POSITIONS_LE

protected static final int[][] POSITIONS_LE

TYPE_BE

public static final int TYPE_BE
See Also:
Constant Field Values

TYPE_LE_SHORT

public static final int TYPE_LE_SHORT
See Also:
Constant Field Values

TYPE_LE_INT

public static final int TYPE_LE_INT
See Also:
Constant Field Values

TYPE_LE_LONG

public static final int TYPE_LE_LONG
See Also:
Constant Field Values
Constructor Detail

XTransformer

public XTransformer()
Method Detail

get

public static final int[] get(int type)

byteToInt

public static final int byteToInt(byte[] source,
                                  int sourceOffset,
                                  int[] dest,
                                  int destOffset,
                                  int[] positions)
write int in BIG_ENDIAN order

Parameters:
source - source byte array
sourceOffset - offset in source array
destOffset - offset in destination array
Returns:
new offset in source array (for next writeUnitXX)

byteToInt

public static final int byteToInt(byte[] source,
                                  int sourceOffset,
                                  int[] positions)

intToByte

public static final int intToByte(int[] source,
                                  int sourceOffset,
                                  byte[] dest,
                                  int destOffset,
                                  int[] positions)
read int in BIG_ENDIAN order

Parameters:
sourceOffset - offset in source array
dest - byte array (destination)
destOffset - offset in destination array
Returns:
offset in destination array (updated)

intToByte

public static final int intToByte(int v,
                                  byte[] dest,
                                  int destOffset,
                                  int[] positions)

intToByte

public static final void intToByte(int[] source,
                                   int srcOffset,
                                   int count,
                                   byte[] dest,
                                   int destOffset,
                                   int[] positions)
convert count ints to bytes (Big Endian)

Parameters:
source - int array
srcOffset - start offset in source array
count - how much ints to process
dest - destination byte array
destOffset -

byteToInt

public static final void byteToInt(byte[] source,
                                   int sourceOffset,
                                   int count,
                                   int[] dest,
                                   int destOffset,
                                   int[] positions)

byteToChar

public static int byteToChar(byte[] source,
                             int sourceOffset,
                             char[] dest,
                             int destOffset,
                             int[] positions)

byteToChar

public static int byteToChar(byte[] source,
                             int sourceOffset,
                             int[] positions)

byteToChar

public static void byteToChar(byte[] source,
                              int sourceOffset,
                              int count,
                              char[] dest,
                              int destOffset,
                              int[] positions)

charToByte

public static int charToByte(char[] source,
                             int srcOffset,
                             byte[] dest,
                             int destOffset,
                             int[] positions)

charToByte

public static int charToByte(char v,
                             byte[] dest,
                             int destOffset,
                             int[] positions)

charToByte

public static void charToByte(char[] source,
                              int srcOffset,
                              int count,
                              byte[] dest,
                              int destOffset,
                              int[] positions)

byteToDouble

public static int byteToDouble(byte[] source,
                               int sourceOffset,
                               double[] dest,
                               int destOffset,
                               int[] positions)

byteToDouble

public static double byteToDouble(byte[] source,
                                  int sourceOffset,
                                  int[] positions)

byteToDouble

public static void byteToDouble(byte[] source,
                                int sourceOffset,
                                int count,
                                double[] dest,
                                int destOffset,
                                int[] positions)

doubleToByte

public static int doubleToByte(double[] source,
                               int srcOffset,
                               byte[] dest,
                               int destOffset,
                               int[] positions)

doubleToByte

public static int doubleToByte(double d,
                               byte[] dest,
                               int destOffset,
                               int[] positions)

doubleToByte

public static void doubleToByte(double[] source,
                                int srcOffset,
                                int count,
                                byte[] dest,
                                int destOffset,
                                int[] positions)

byteToFloat

public static int byteToFloat(byte[] source,
                              int sourceOffset,
                              float[] dest,
                              int destOffset,
                              int[] positions)

byteToFloat

public static float byteToFloat(byte[] source,
                                int sourceOffset,
                                int[] positions)

byteToFloat

public static void byteToFloat(byte[] source,
                               int sourceOffset,
                               int count,
                               float[] dest,
                               int destOffset,
                               int[] positions)

floatToByte

public static int floatToByte(float[] source,
                              int offset,
                              byte[] dest,
                              int destOffset,
                              int[] positions)

floatToByte

public static int floatToByte(float f,
                              byte[] dest,
                              int destOffset,
                              int[] positions)

floatToByte

public static void floatToByte(float[] source,
                               int offset,
                               int count,
                               byte[] dest,
                               int destOffset,
                               int[] positions)

byteToLong

public static int byteToLong(byte[] source,
                             int sourceOffset,
                             long[] dest,
                             int destOffset,
                             int[] positions)

byteToLong

public static long byteToLong(byte[] source,
                              int sourceOffset,
                              int[] positions)

byteToLong

public static void byteToLong(byte[] source,
                              int sourceOffset,
                              int count,
                              long[] dest,
                              int destOffset,
                              int[] positions)

longToByte

public static int longToByte(long[] source,
                             int offset,
                             byte[] dest,
                             int destOffset,
                             int[] positions)

longToByte

public static int longToByte(long v,
                             byte[] dest,
                             int destOffset,
                             int[] positions)

longToByte

public static void longToByte(long[] source,
                              int offset,
                              int count,
                              byte[] dest,
                              int destOffset,
                              int[] positions)

byteToShort

public static int byteToShort(byte[] source,
                              int sourceOffset,
                              short[] dest,
                              int destOffset,
                              int[] positions)

byteToShort

public static int byteToShort(byte[] source,
                              int sourceOffset,
                              int[] positions)

byteToShort

public static void byteToShort(byte[] source,
                               int sourceOffset,
                               int count,
                               short[] dest,
                               int destOffset,
                               int[] positions)

shortToByte

public static int shortToByte(short[] source,
                              int offset,
                              byte[] dest,
                              int destOffset,
                              int[] positions)

shortToByte

public static int shortToByte(short v,
                              byte[] dest,
                              int destOffset,
                              int[] positions)

shortToByte

public static void shortToByte(short[] source,
                               int offset,
                               int count,
                               byte[] dest,
                               int destOffset,
                               int[] positions)

byteToInt

public static final void byteToInt(int bytesInInt,
                                   byte[] source,
                                   int sourceOffset,
                                   int count,
                                   int[] dest,
                                   int destOffset,
                                   int[] positions)

byteToShort

public static final void byteToShort(int bytesInShort,
                                     byte[] source,
                                     int sourceOffset,
                                     int count,
                                     short[] dest,
                                     int destOffset,
                                     int[] positions)

byteToLong

public static final void byteToLong(int bytesInLong,
                                    byte[] source,
                                    int sourceOffset,
                                    int count,
                                    long[] dest,
                                    int destOffset,
                                    int[] positions)

byteToInt

public static final int byteToInt(int bytesInInt,
                                  byte[] source,
                                  int sourceOffset,
                                  int[] dest,
                                  int destOffset,
                                  int[] positions)

byteToShort

public static final int byteToShort(int bytesInShort,
                                    byte[] source,
                                    int sourceOffset,
                                    short[] dest,
                                    int destOffset,
                                    int[] positions)

byteToLong

public static final int byteToLong(int bytesInLong,
                                   byte[] source,
                                   int sourceOffset,
                                   long[] dest,
                                   int destOffset,
                                   int[] positions)