global
Class Convert

java.lang.Object
  extended byglobal.Convert

public class Convert
extends java.lang.Object


Constructor Summary
Convert()
           
 
Method Summary
static char getCharValue(int position, byte[] data)
          reads 2 bytes from the given byte array at the specified position convert it to a character
static float getFloValue(int position, byte[] data)
          read 4 bytes from given byte array at the specified position convert it to a float value
static int getIntValue(int position, byte[] data)
          read 4 bytes from given byte array at the specified position convert it to an integer
static short getShortValue(int position, byte[] data)
          read 2 bytes from given byte array at the specified position convert it to a short integer
static java.lang.String getStrValue(int position, byte[] data, int length)
          reads a string that has been encoded using a modified UTF-8 format from the given byte array at the specified position
static void setCharValue(char value, int position, byte[] data)
          Update a character in the given byte array at the specified position.
static void setFloValue(float value, int position, byte[] data)
          update a float value in the given byte array at the specified position
static void setIntValue(java.lang.Integer value, int position, byte[] data)
          update an integer value in the given byte array at the specified position
static void setIntValue(int value, int position, byte[] data)
           
static void setShortValue(short value, int position, byte[] data)
          update a short integer in the given byte array at the specified position
static void setStrValue(java.lang.String value, int position, byte[] data)
          Insert or update a string in the given byte array at the specified position.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Convert

public Convert()
Method Detail

getIntValue

public static int getIntValue(int position,
                              byte[] data)
                       throws java.io.IOException
read 4 bytes from given byte array at the specified position convert it to an integer

Parameters:
data - a byte array
position - in data[]
Returns:
the integer
Throws:
java.io.IOException - I/O errors

getFloValue

public static float getFloValue(int position,
                                byte[] data)
                         throws java.io.IOException
read 4 bytes from given byte array at the specified position convert it to a float value

Parameters:
data - a byte array
position - in data[]
Returns:
the float value
Throws:
java.io.IOException - I/O errors

getShortValue

public static short getShortValue(int position,
                                  byte[] data)
                           throws java.io.IOException
read 2 bytes from given byte array at the specified position convert it to a short integer

Parameters:
data - a byte array
position - the position in data[]
Returns:
the short integer
Throws:
java.io.IOException - I/O errors

getStrValue

public static java.lang.String getStrValue(int position,
                                           byte[] data,
                                           int length)
                                    throws java.io.IOException
reads a string that has been encoded using a modified UTF-8 format from the given byte array at the specified position

Parameters:
data - a byte array
position - the position in data[]
length - the length of the string in bytes (=strlength +2)
Returns:
the string
Throws:
java.io.IOException - I/O errors

getCharValue

public static char getCharValue(int position,
                                byte[] data)
                         throws java.io.IOException
reads 2 bytes from the given byte array at the specified position convert it to a character

Parameters:
data - a byte array
position - the position in data[]
Returns:
the character
Throws:
java.io.IOException - I/O errors

setIntValue

public static void setIntValue(java.lang.Integer value,
                               int position,
                               byte[] data)
                        throws java.io.IOException
update an integer value in the given byte array at the specified position

Parameters:
data - a byte array
value - the value to be copied into the data[]
position - the position of tht value in data[]
Throws:
java.io.IOException - I/O errors

setIntValue

public static void setIntValue(int value,
                               int position,
                               byte[] data)
                        throws java.io.IOException
Throws:
java.io.IOException

setFloValue

public static void setFloValue(float value,
                               int position,
                               byte[] data)
                        throws java.io.IOException
update a float value in the given byte array at the specified position

Parameters:
data - a byte array
value - the value to be copied into the data[]
position - the position of tht value in data[]
Throws:
java.io.IOException - I/O errors

setShortValue

public static void setShortValue(short value,
                                 int position,
                                 byte[] data)
                          throws java.io.IOException
update a short integer in the given byte array at the specified position

Parameters:
data - a byte array
value - the value to be copied into data[]
position - the position of tht value in data[]
Throws:
java.io.IOException - I/O errors

setStrValue

public static void setStrValue(java.lang.String value,
                               int position,
                               byte[] data)
                        throws java.io.IOException
Insert or update a string in the given byte array at the specified position.

Parameters:
data - a byte array
value - the value to be copied into data[]
position - the position of tht value in data[]
Throws:
java.io.IOException - I/O errors

setCharValue

public static void setCharValue(char value,
                                int position,
                                byte[] data)
                         throws java.io.IOException
Update a character in the given byte array at the specified position.

Parameters:
data - a byte array
value - the value to be copied into data[]
position - the position of tht value in data[]
Throws:
java.io.IOException - I/O errors