global
Class Convert

java.lang.Object
  extended by global.Convert

public class Convert
extends java.lang.Object

Provides conversion routines for getting and setting data in byte arrays.


Constructor Summary
Convert()
           
 
Method Summary
static char getCharValue(int pos, byte[] data)
          Reads from the given byte array at the specified position, and converts it into a unicode character.
static float getFloatValue(int pos, byte[] data)
          Reads from the given byte array at the specified position, and converts it to a float.
static int getIntValue(int pos, byte[] data)
          Reads from the given byte array at the specified position, and converts it into an integer.
static short getShortValue(int pos, byte[] data)
          Reads from the given byte array at the specified position, and converts it into a short.
static java.lang.String getStringValue(int pos, byte[] data, int length)
          Reads from the given byte array at the specified position, and converts it to a string of given length.
static void setCharValue(char value, int pos, byte[] data)
          Writes a unicode character into the given byte array at the specified position.
static void setFloatValue(float value, int pos, byte[] data)
          Writes a float into the given byte array at the specified position.
static void setIntValue(int value, int pos, byte[] data)
          Writes an integer into the given byte array at the specified position.
static void setShortValue(short value, int pos, byte[] data)
          Writes a short into the given byte array at the specified position.
static void setStringValue(java.lang.String value, int pos, byte[] data)
          Writes a string into the given byte array at the specified position.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Convert

public Convert()
Method Detail

getCharValue

public static char getCharValue(int pos,
                                byte[] data)
Reads from the given byte array at the specified position, and converts it into a unicode character.


setCharValue

public static void setCharValue(char value,
                                int pos,
                                byte[] data)
Writes a unicode character into the given byte array at the specified position.


getShortValue

public static short getShortValue(int pos,
                                  byte[] data)
Reads from the given byte array at the specified position, and converts it into a short.


setShortValue

public static void setShortValue(short value,
                                 int pos,
                                 byte[] data)
Writes a short into the given byte array at the specified position.


getIntValue

public static int getIntValue(int pos,
                              byte[] data)
Reads from the given byte array at the specified position, and converts it into an integer.


setIntValue

public static void setIntValue(int value,
                               int pos,
                               byte[] data)
Writes an integer into the given byte array at the specified position.


getFloatValue

public static float getFloatValue(int pos,
                                  byte[] data)
Reads from the given byte array at the specified position, and converts it to a float.


setFloatValue

public static void setFloatValue(float value,
                                 int pos,
                                 byte[] data)
Writes a float into the given byte array at the specified position.


getStringValue

public static java.lang.String getStringValue(int pos,
                                              byte[] data,
                                              int length)
Reads from the given byte array at the specified position, and converts it to a string of given length.


setStringValue

public static void setStringValue(java.lang.String value,
                                  int pos,
                                  byte[] data)
Writes a string into the given byte array at the specified position.