uka.transport
Class BasicIO

java.lang.Object
  extended byuka.transport.BasicIO
All Implemented Interfaces:
TransportConstants
Direct Known Subclasses:
ValueIO

public class BasicIO
extends java.lang.Object
implements TransportConstants

Provides static methods for the conversion of primitive values to and from byte arrays.

Author:
Bernhard Haumacher

Field Summary
 
Fields inherited from interface uka.transport.TransportConstants
REQUEST_MAX, REQUEST_MAX_boolean, REQUEST_MAX_byte, REQUEST_MAX_char, REQUEST_MAX_double, REQUEST_MAX_float, REQUEST_MAX_int, REQUEST_MAX_long, REQUEST_MAX_short, SIZEOF_boolean, SIZEOF_byte, SIZEOF_char, SIZEOF_double, SIZEOF_float, SIZEOF_int, SIZEOF_long, SIZEOF_short, TC_ANONYMOUS, TC_DEFAULT, TC_EXCEPTION, TC_NEW, TC_NULL, TC_REFERENCE, TC_REPLACEMENT, TC_RESET, TC_RESETTYPE, TC_TYPE, TC_USER
 
Constructor Summary
BasicIO()
           
 
Method Summary
static int extract(byte[] buffer, int pos, boolean[] fs)
          fill the array 'fs' with values extracted from array 'buffer'.
static int extract(byte[] buffer, int pos, boolean[] fs, int foff, int fcnt)
          fill 'fcnt' positions in the array 'fs' starting with index 'foff' with values extracted from array 'buffer'.
static int extract(byte[] buffer, int pos, byte[] fs)
          fill the array 'fs' with values extracted from array 'buffer'.
static int extract(byte[] buffer, int pos, byte[] fs, int foff, int fcnt)
          fill 'fcnt' positions in the array 'fs' starting with index 'foff' with values extracted from array 'buffer'.
static int extract(byte[] buffer, int pos, char[] fs)
          fill the array 'fs' with values extracted from array 'buffer'.
static int extract(byte[] buffer, int pos, char[] fs, int foff, int fcnt)
          fill 'fcnt' positions in the array 'fs' starting with index 'foff' with values extracted from array 'buffer'.
static int extract(byte[] buffer, int pos, double[] fs)
          fill the array 'fs' with values extracted from array 'buffer'.
static int extract(byte[] buffer, int pos, double[] fs, int foff, int fcnt)
          fill 'fcnt' positions in the array 'fs' starting with index 'foff' with values extracted from array 'buffer'.
static int extract(byte[] buffer, int pos, float[] fs)
          fill the array 'fs' with values extracted from array 'buffer'.
static int extract(byte[] buffer, int pos, float[] fs, int foff, int fcnt)
          fill 'fcnt' positions in the array 'fs' starting with index 'foff' with values extracted from array 'buffer'.
static int extract(byte[] buffer, int pos, int[] fs)
          fill the array 'fs' with values extracted from array 'buffer'.
static int extract(byte[] buffer, int pos, int[] fs, int foff, int fcnt)
          fill 'fcnt' positions in the array 'fs' starting with index 'foff' with values extracted from array 'buffer'.
static int extract(byte[] buffer, int pos, long[] fs)
          fill the array 'fs' with values extracted from array 'buffer'.
static int extract(byte[] buffer, int pos, long[] fs, int foff, int fcnt)
          fill 'fcnt' positions in the array 'fs' starting with index 'foff' with values extracted from array 'buffer'.
static int extract(byte[] buffer, int pos, short[] fs)
          fill the array 'fs' with values extracted from array 'buffer'.
static int extract(byte[] buffer, int pos, short[] fs, int foff, int fcnt)
          fill 'fcnt' positions in the array 'fs' starting with index 'foff' with values extracted from array 'buffer'.
static boolean extractBoolean(byte[] buffer, int pos)
          extract a boolean at position 'pos' from array 'buffer'
static byte extractByte(byte[] buffer, int pos)
          extract a byte at position 'pos' from array 'buffer'
static char extractChar(byte[] buffer, int pos)
          extract a char at position 'pos' from array 'buffer'
static double extractDouble(byte[] buffer, int pos)
          extract a double at position 'pos' from array 'buffer'
static float extractFloat(byte[] buffer, int pos)
          extract a float at position 'pos' from array 'buffer'
static int extractInt(byte[] buffer, int pos)
          extract an int at position 'pos' from array 'buffer'
static long extractLong(byte[] buffer, int pos)
          extract a long at position 'pos' from array 'buffer'
static short extractShort(byte[] buffer, int pos)
          extract a short at position 'pos' from array 'buffer'
static int extractUnsignedByte(byte[] buffer, int pos)
          extract an unsigned byte at position 'pos' from array 'buffer'
static int extractUnsignedShort(byte[] buffer, int pos)
          extract an unsigned short at position 'pos' from array 'buffer'
static int insert(byte[] buffer, int pos, boolean d)
          insert the boolean 'd' into the array 'buffer' at position pos
static int insert(byte[] buffer, int pos, boolean[] fs)
          insert the array 'fs' at position 'pos' into array 'buffer'
static int insert(byte[] buffer, int pos, boolean[] fs, int foff, int fcnt)
          insert 'fcnt' values from array 'fs' starting with index 'foff' at position 'pos' into array 'buffer'.
static int insert(byte[] buffer, int pos, byte d)
          insert the byte 'd' into the array 'buffer' at position pos
static int insert(byte[] buffer, int pos, byte[] fs)
          insert the array 'fs' at position 'pos' into array 'buffer'
static int insert(byte[] buffer, int pos, byte[] fs, int foff, int fcnt)
          insert 'fcnt' values from array 'fs' starting with index 'foff' at position 'pos' into array 'buffer'.
static int insert(byte[] buffer, int pos, char d)
          insert the char 'd' into the array 'buffer' at position pos
static int insert(byte[] buffer, int pos, char[] fs)
          insert the array 'fs' at position 'pos' into array 'buffer'
static int insert(byte[] buffer, int pos, char[] fs, int foff, int fcnt)
          insert 'fcnt' values from array 'fs' starting with index 'foff' at position 'pos' into array 'buffer'.
static int insert(byte[] buffer, int pos, double f)
          insert the double 'd' into the array 'buffer' at position pos
static int insert(byte[] buffer, int pos, double[] fs)
          insert the array 'fs' at position 'pos' into array 'buffer'
static int insert(byte[] buffer, int pos, double[] fs, int foff, int fcnt)
          insert 'fcnt' values from array 'fs' starting with index 'foff' at position 'pos' into array 'buffer'.
static int insert(byte[] buffer, int pos, float f)
          insert the float 'd' into the array 'buffer' at position pos
static int insert(byte[] buffer, int pos, float[] fs)
          insert the array 'fs' at position 'pos' into array 'buffer'
static int insert(byte[] buffer, int pos, float[] fs, int foff, int fcnt)
          insert 'fcnt' values from array 'fs' starting with index 'foff' at position 'pos' into array 'buffer'.
static int insert(byte[] buffer, int pos, int d)
          insert the int 'd' into the array 'buffer' at position pos
static int insert(byte[] buffer, int pos, int[] fs)
          insert the array 'fs' at position 'pos' into array 'buffer'
static int insert(byte[] buffer, int pos, int[] fs, int foff, int fcnt)
          insert 'fcnt' values from array 'fs' starting with index 'foff' at position 'pos' into array 'buffer'.
static int insert(byte[] buffer, int pos, long d)
          insert the long 'd' into the array 'buffer' at position pos
static int insert(byte[] buffer, int pos, long[] fs)
          insert the array 'fs' at position 'pos' into array 'buffer'
static int insert(byte[] buffer, int pos, long[] fs, int foff, int fcnt)
          insert 'fcnt' values from array 'fs' starting with index 'foff' at position 'pos' into array 'buffer'.
static int insert(byte[] buffer, int pos, short d)
          insert the short 'd' into the array 'buffer' at position pos
static int insert(byte[] buffer, int pos, short[] fs)
          insert the array 'fs' at position 'pos' into array 'buffer'
static int insert(byte[] buffer, int pos, short[] fs, int foff, int fcnt)
          insert 'fcnt' values from array 'fs' starting with index 'foff' at position 'pos' into array 'buffer'.
static int sizeof(boolean n)
           
static int sizeof(boolean[] n)
           
static int sizeof(byte n)
           
static int sizeof(byte[] n)
           
static int sizeof(char n)
           
static int sizeof(char[] n)
           
static int sizeof(double n)
           
static int sizeof(double[] n)
           
static int sizeof(float n)
           
static int sizeof(float[] n)
           
static int sizeof(int n)
           
static int sizeof(int[] n)
           
static int sizeof(long n)
           
static int sizeof(long[] n)
           
static int sizeof(short n)
           
static int sizeof(short[] n)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicIO

public BasicIO()
Method Detail

insert

public static final int insert(byte[] buffer,
                               int pos,
                               byte d)
insert the byte 'd' into the array 'buffer' at position pos

Returns:
new position after the insertion

insert

public static final int insert(byte[] buffer,
                               int pos,
                               boolean d)
insert the boolean 'd' into the array 'buffer' at position pos

Returns:
new position after the insertion

insert

public static final int insert(byte[] buffer,
                               int pos,
                               short d)
insert the short 'd' into the array 'buffer' at position pos

Returns:
new position after the insertion

insert

public static final int insert(byte[] buffer,
                               int pos,
                               char d)
insert the char 'd' into the array 'buffer' at position pos

Returns:
new position after the insertion

insert

public static final int insert(byte[] buffer,
                               int pos,
                               int d)
insert the int 'd' into the array 'buffer' at position pos

Returns:
new position after the insertion

insert

public static final int insert(byte[] buffer,
                               int pos,
                               long d)
insert the long 'd' into the array 'buffer' at position pos

Returns:
new position after the insertion

insert

public static final int insert(byte[] buffer,
                               int pos,
                               float f)
insert the float 'd' into the array 'buffer' at position pos

Returns:
new position after the insertion

insert

public static final int insert(byte[] buffer,
                               int pos,
                               double f)
insert the double 'd' into the array 'buffer' at position pos

Returns:
new position after the insertion

extractBoolean

public static final boolean extractBoolean(byte[] buffer,
                                           int pos)
extract a boolean at position 'pos' from array 'buffer'

Returns:
the extracted value

extractByte

public static final byte extractByte(byte[] buffer,
                                     int pos)
extract a byte at position 'pos' from array 'buffer'

Returns:
the extracted value

extractUnsignedByte

public static final int extractUnsignedByte(byte[] buffer,
                                            int pos)
extract an unsigned byte at position 'pos' from array 'buffer'

Returns:
the extracted value as int

extractShort

public static final short extractShort(byte[] buffer,
                                       int pos)
extract a short at position 'pos' from array 'buffer'

Returns:
the extracted value

extractUnsignedShort

public static final int extractUnsignedShort(byte[] buffer,
                                             int pos)
extract an unsigned short at position 'pos' from array 'buffer'

Returns:
the extracted value as int

extractChar

public static final char extractChar(byte[] buffer,
                                     int pos)
extract a char at position 'pos' from array 'buffer'

Returns:
the extracted value

extractInt

public static final int extractInt(byte[] buffer,
                                   int pos)
extract an int at position 'pos' from array 'buffer'

Returns:
the extracted value

extractLong

public static final long extractLong(byte[] buffer,
                                     int pos)
extract a long at position 'pos' from array 'buffer'

Returns:
the extracted value

extractFloat

public static final float extractFloat(byte[] buffer,
                                       int pos)
extract a float at position 'pos' from array 'buffer'

Returns:
the extracted value

extractDouble

public static final double extractDouble(byte[] buffer,
                                         int pos)
extract a double at position 'pos' from array 'buffer'

Returns:
the extracted value

sizeof

public static final int sizeof(boolean n)
Returns:
the size of the argument in bytes.

sizeof

public static final int sizeof(boolean[] n)
Returns:
the size of the argument in bytes.

insert

public static final int insert(byte[] buffer,
                               int pos,
                               boolean[] fs)
insert the array 'fs' at position 'pos' into array 'buffer'

Returns:
the new position after the insertion.

insert

public static final int insert(byte[] buffer,
                               int pos,
                               boolean[] fs,
                               int foff,
                               int fcnt)
insert 'fcnt' values from array 'fs' starting with index 'foff' at position 'pos' into array 'buffer'.

Returns:
the new position after the insertion.

extract

public static final int extract(byte[] buffer,
                                int pos,
                                boolean[] fs)
fill the array 'fs' with values extracted from array 'buffer'.

Returns:
the new position after the insertion.

extract

public static final int extract(byte[] buffer,
                                int pos,
                                boolean[] fs,
                                int foff,
                                int fcnt)
fill 'fcnt' positions in the array 'fs' starting with index 'foff' with values extracted from array 'buffer'.

Returns:
the new position after the insertion.

sizeof

public static final int sizeof(byte n)
Returns:
the size of the argument in bytes.

sizeof

public static final int sizeof(byte[] n)
Returns:
the size of the argument in bytes.

insert

public static final int insert(byte[] buffer,
                               int pos,
                               byte[] fs)
insert the array 'fs' at position 'pos' into array 'buffer'

Returns:
the new position after the insertion.

insert

public static final int insert(byte[] buffer,
                               int pos,
                               byte[] fs,
                               int foff,
                               int fcnt)
insert 'fcnt' values from array 'fs' starting with index 'foff' at position 'pos' into array 'buffer'.

Returns:
the new position after the insertion.

extract

public static final int extract(byte[] buffer,
                                int pos,
                                byte[] fs)
fill the array 'fs' with values extracted from array 'buffer'.

Returns:
the new position after the insertion.

extract

public static final int extract(byte[] buffer,
                                int pos,
                                byte[] fs,
                                int foff,
                                int fcnt)
fill 'fcnt' positions in the array 'fs' starting with index 'foff' with values extracted from array 'buffer'.

Returns:
the new position after the insertion.

sizeof

public static final int sizeof(char n)
Returns:
the size of the argument in bytes.

sizeof

public static final int sizeof(char[] n)
Returns:
the size of the argument in bytes.

insert

public static final int insert(byte[] buffer,
                               int pos,
                               char[] fs)
insert the array 'fs' at position 'pos' into array 'buffer'

Returns:
the new position after the insertion.

insert

public static final int insert(byte[] buffer,
                               int pos,
                               char[] fs,
                               int foff,
                               int fcnt)
insert 'fcnt' values from array 'fs' starting with index 'foff' at position 'pos' into array 'buffer'.

Returns:
the new position after the insertion.

extract

public static final int extract(byte[] buffer,
                                int pos,
                                char[] fs)
fill the array 'fs' with values extracted from array 'buffer'.

Returns:
the new position after the insertion.

extract

public static final int extract(byte[] buffer,
                                int pos,
                                char[] fs,
                                int foff,
                                int fcnt)
fill 'fcnt' positions in the array 'fs' starting with index 'foff' with values extracted from array 'buffer'.

Returns:
the new position after the insertion.

sizeof

public static final int sizeof(short n)
Returns:
the size of the argument in bytes.

sizeof

public static final int sizeof(short[] n)
Returns:
the size of the argument in bytes.

insert

public static final int insert(byte[] buffer,
                               int pos,
                               short[] fs)
insert the array 'fs' at position 'pos' into array 'buffer'

Returns:
the new position after the insertion.

insert

public static final int insert(byte[] buffer,
                               int pos,
                               short[] fs,
                               int foff,
                               int fcnt)
insert 'fcnt' values from array 'fs' starting with index 'foff' at position 'pos' into array 'buffer'.

Returns:
the new position after the insertion.

extract

public static final int extract(byte[] buffer,
                                int pos,
                                short[] fs)
fill the array 'fs' with values extracted from array 'buffer'.

Returns:
the new position after the insertion.

extract

public static final int extract(byte[] buffer,
                                int pos,
                                short[] fs,
                                int foff,
                                int fcnt)
fill 'fcnt' positions in the array 'fs' starting with index 'foff' with values extracted from array 'buffer'.

Returns:
the new position after the insertion.

sizeof

public static final int sizeof(int n)
Returns:
the size of the argument in bytes.

sizeof

public static final int sizeof(int[] n)
Returns:
the size of the argument in bytes.

insert

public static final int insert(byte[] buffer,
                               int pos,
                               int[] fs)
insert the array 'fs' at position 'pos' into array 'buffer'

Returns:
the new position after the insertion.

insert

public static final int insert(byte[] buffer,
                               int pos,
                               int[] fs,
                               int foff,
                               int fcnt)
insert 'fcnt' values from array 'fs' starting with index 'foff' at position 'pos' into array 'buffer'.

Returns:
the new position after the insertion.

extract

public static final int extract(byte[] buffer,
                                int pos,
                                int[] fs)
fill the array 'fs' with values extracted from array 'buffer'.

Returns:
the new position after the insertion.

extract

public static final int extract(byte[] buffer,
                                int pos,
                                int[] fs,
                                int foff,
                                int fcnt)
fill 'fcnt' positions in the array 'fs' starting with index 'foff' with values extracted from array 'buffer'.

Returns:
the new position after the insertion.

sizeof

public static final int sizeof(long n)
Returns:
the size of the argument in bytes.

sizeof

public static final int sizeof(long[] n)
Returns:
the size of the argument in bytes.

insert

public static final int insert(byte[] buffer,
                               int pos,
                               long[] fs)
insert the array 'fs' at position 'pos' into array 'buffer'

Returns:
the new position after the insertion.

insert

public static final int insert(byte[] buffer,
                               int pos,
                               long[] fs,
                               int foff,
                               int fcnt)
insert 'fcnt' values from array 'fs' starting with index 'foff' at position 'pos' into array 'buffer'.

Returns:
the new position after the insertion.

extract

public static final int extract(byte[] buffer,
                                int pos,
                                long[] fs)
fill the array 'fs' with values extracted from array 'buffer'.

Returns:
the new position after the insertion.

extract

public static final int extract(byte[] buffer,
                                int pos,
                                long[] fs,
                                int foff,
                                int fcnt)
fill 'fcnt' positions in the array 'fs' starting with index 'foff' with values extracted from array 'buffer'.

Returns:
the new position after the insertion.

sizeof

public static final int sizeof(float n)
Returns:
the size of the argument in bytes.

sizeof

public static final int sizeof(float[] n)
Returns:
the size of the argument in bytes.

insert

public static final int insert(byte[] buffer,
                               int pos,
                               float[] fs)
insert the array 'fs' at position 'pos' into array 'buffer'

Returns:
the new position after the insertion.

insert

public static final int insert(byte[] buffer,
                               int pos,
                               float[] fs,
                               int foff,
                               int fcnt)
insert 'fcnt' values from array 'fs' starting with index 'foff' at position 'pos' into array 'buffer'.

Returns:
the new position after the insertion.

extract

public static final int extract(byte[] buffer,
                                int pos,
                                float[] fs)
fill the array 'fs' with values extracted from array 'buffer'.

Returns:
the new position after the insertion.

extract

public static final int extract(byte[] buffer,
                                int pos,
                                float[] fs,
                                int foff,
                                int fcnt)
fill 'fcnt' positions in the array 'fs' starting with index 'foff' with values extracted from array 'buffer'.

Returns:
the new position after the insertion.

sizeof

public static final int sizeof(double n)
Returns:
the size of the argument in bytes.

sizeof

public static final int sizeof(double[] n)
Returns:
the size of the argument in bytes.

insert

public static final int insert(byte[] buffer,
                               int pos,
                               double[] fs)
insert the array 'fs' at position 'pos' into array 'buffer'

Returns:
the new position after the insertion.

insert

public static final int insert(byte[] buffer,
                               int pos,
                               double[] fs,
                               int foff,
                               int fcnt)
insert 'fcnt' values from array 'fs' starting with index 'foff' at position 'pos' into array 'buffer'.

Returns:
the new position after the insertion.

extract

public static final int extract(byte[] buffer,
                                int pos,
                                double[] fs)
fill the array 'fs' with values extracted from array 'buffer'.

Returns:
the new position after the insertion.

extract

public static final int extract(byte[] buffer,
                                int pos,
                                double[] fs,
                                int foff,
                                int fcnt)
fill 'fcnt' positions in the array 'fs' starting with index 'foff' with values extracted from array 'buffer'.

Returns:
the new position after the insertion.