com.latencybusters.pdm
Class PDMDeserializer

java.lang.Object
  extended by com.latencybusters.pdm.PDMDeserializer

public class PDMDeserializer
extends java.lang.Object

Used to deserialize bytes into the appropriate type


Constructor Summary
PDMDeserializer()
           
 
Method Summary
 boolean isByteSwap()
          Gets whether the byteSwap flag is set
 boolean readBoolean(byte[] ba, int pos)
          This method will use one bytes from the given byte array starting at position to create a boolean.
 byte readByte(byte[] ba, int pos)
          This method will use one bytes from the given byte array starting at position to create a byte.
 void readByteArray(byte[] ba, int pos, byte[] destByteArray)
          Copies bytes from the source byte array (ba) into the destination byte array
 void readByteArray(byte[] ba, int pos, byte[] destByteArray, int copyLen)
          Copies bytes from the source byte array (ba) into the destination byte array
 byte[] readByteArray(byte[] ba, int pos, int length)
          Creates a new byte array from the source byte array (ba) at position for the given length
 PDMDecimal readDecimal(byte[] ba, int pos)
          This method will use eight bytes from the given byte array starting at position to create a PDMDecimal.
 PDMDecimal readDecimal(byte[] ba, int pos, boolean byteSwap)
          This method will use nine bytes from the given byte array starting at position to create a PDMDecimal.
 double readDouble(byte[] ba, int pos)
          This method will use eight bytes from the given byte array starting at position to create a double.
 double readDouble(byte[] ba, int pos, boolean byteSwap)
          This method will use eight bytes from the given byte array starting at position to create a double.
 float readFloat(byte[] ba, int pos)
          This method will use four bytes from the given byte array starting at position to create a float.
 float readFloat(byte[] ba, int pos, boolean byteSwap)
          This method will use four bytes from the given byte array starting at position to create a float.
 int readInt(byte[] ba, int pos)
          This method will use four bytes from the given byte array starting at position to create an int.
 int readInt(byte[] ba, int pos, boolean byteSwap)
          This method will use four bytes from the given byte array starting at position to create an int.
 long readLong(byte[] ba, int pos)
          This method will use eight bytes from the given byte array starting at position to create a long.
 long readLong(byte[] ba, int pos, boolean byteSwap)
          This method will use eight bytes from the given byte array starting at position to create a long.
 short readShort(byte[] ba, int pos)
          This method will use two bytes from the given byte array starting at position to create a short.
 short readShort(byte[] ba, int pos, boolean byteSwap)
          This method will use two bytes from the given byte array starting at position to create a short.
 java.lang.String readString(byte[] ba, int pos, int len)
          This method will read the specified len at position pos from the byte array and create a String expecting the String to end with a byte 0
 PDMTimestamp readTimestamp(byte[] ba, int pos)
          This method will use eight bytes from the given byte array starting at position to create a PDMTimestamp.
 PDMTimestamp readTimestamp(byte[] ba, int pos, boolean byteSwap)
          This method will use eight bytes from the given byte array starting at position to create a PDMTimestamp.
 short readUByte(byte[] ba, int pos)
          This method will use one bytes from the given byte array starting at position to create an unsigned byte (stored in a short).
 long readUInt(byte[] ba, int pos)
          This method will use four bytes from the given byte array starting at position to create an unsigned int (stored as a long).
 long readUInt(byte[] ba, int pos, boolean byteSwap)
          This method will use four bytes from the given byte array starting at position to create an unsigned int (stored as a long).
 java.math.BigInteger readULong(byte[] ba, int pos)
          This method will use eight bytes from the given byte array starting at position to create an unsigned long (stored in a BigInteger).
 java.math.BigInteger readULong(byte[] ba, int pos, boolean byteSwap)
          This method will use eight bytes from the given byte array starting at position to create an unsigned long (stored in a BigInteger).
 java.lang.String readUnicode(byte[] ba, int pos, int len)
          This method will read the specified len at position pos from the byte array and create a UTF-8 unicode String expecting the String to end with a byte 0
 java.lang.String readUnicode(byte[] ba, int pos, int len, java.lang.String charSet)
          This method will read the specified len at position pos from the byte array and create a unicode String expecting the String to end with a byte 0
 int readUShort(byte[] ba, int pos)
          This method will use two bytes from the given byte array starting at position to create an unsigned short (stored as an int).
 int readUShort(byte[] ba, int pos, boolean byteSwap)
          This method will use two bytes from the given byte array starting at position to create an unsigned short (stored as an int).
 void setByteSwap(byte[] ba, int pos, int magic)
          Sets the flag on whether to swap bytes by comparing the magic number read in from the ba at the specified pos to the one passed in
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PDMDeserializer

public PDMDeserializer()
Method Detail

setByteSwap

public void setByteSwap(byte[] ba,
                        int pos,
                        int magic)
Sets the flag on whether to swap bytes by comparing the magic number read in from the ba at the specified pos to the one passed in

Parameters:
ba - the byte array
pos - the position to start reading
magic -

isByteSwap

public boolean isByteSwap()
Gets whether the byteSwap flag is set

Returns:
true if byteSwap flag is set

readBoolean

public boolean readBoolean(byte[] ba,
                           int pos)
This method will use one bytes from the given byte array starting at position to create a boolean.

Parameters:
ba - the byte array
pos - the position to start reading
Returns:
the boolean

readByte

public byte readByte(byte[] ba,
                     int pos)
This method will use one bytes from the given byte array starting at position to create a byte.

Parameters:
ba - the byte array
pos - the position to start reading
Returns:
the byte

readUByte

public short readUByte(byte[] ba,
                       int pos)
This method will use one bytes from the given byte array starting at position to create an unsigned byte (stored in a short).

Parameters:
ba - the byte array
pos - the position to start reading
Returns:
the unsigned byte

readShort

public short readShort(byte[] ba,
                       int pos,
                       boolean byteSwap)
This method will use two bytes from the given byte array starting at position to create a short.

Parameters:
ba - the byte array
pos - the position to start reading
byteSwap - whether or not the bytes need to be swapped
Returns:
the short

readShort

public short readShort(byte[] ba,
                       int pos)
This method will use two bytes from the given byte array starting at position to create a short.

Parameters:
ba - the byte array
pos - the position to start reading
Returns:
the short

readUShort

public int readUShort(byte[] ba,
                      int pos,
                      boolean byteSwap)
This method will use two bytes from the given byte array starting at position to create an unsigned short (stored as an int).

Parameters:
ba - the byte array
pos - the position to start reading
byteSwap - whether or not the bytes need to be swapped
Returns:
the unsigned short

readUShort

public int readUShort(byte[] ba,
                      int pos)
This method will use two bytes from the given byte array starting at position to create an unsigned short (stored as an int).

Parameters:
ba - the byte array
pos - the position to start reading
Returns:
the unsigned short

readInt

public int readInt(byte[] ba,
                   int pos,
                   boolean byteSwap)
This method will use four bytes from the given byte array starting at position to create an int.

Parameters:
ba - the byte array
pos - the position to start reading
byteSwap - whether or not the bytes need to be swapped
Returns:
the int

readInt

public int readInt(byte[] ba,
                   int pos)
This method will use four bytes from the given byte array starting at position to create an int.

Parameters:
ba - the byte array
pos - the position to start reading
Returns:
the int

readUInt

public long readUInt(byte[] ba,
                     int pos,
                     boolean byteSwap)
This method will use four bytes from the given byte array starting at position to create an unsigned int (stored as a long).

Parameters:
ba - the byte array
pos - the position to start reading
byteSwap - whether or not the bytes need to be swapped
Returns:
the unsigned int

readUInt

public long readUInt(byte[] ba,
                     int pos)
This method will use four bytes from the given byte array starting at position to create an unsigned int (stored as a long).

Parameters:
ba - the byte array
pos - the position to start reading
Returns:
the unsigned int

readLong

public long readLong(byte[] ba,
                     int pos,
                     boolean byteSwap)
This method will use eight bytes from the given byte array starting at position to create a long.

Parameters:
ba - the byte array
pos - the position to start reading
byteSwap - whether or not the bytes need to be swapped
Returns:
the long

readLong

public long readLong(byte[] ba,
                     int pos)
This method will use eight bytes from the given byte array starting at position to create a long.

Parameters:
ba - the byte array
pos - the position to start reading
Returns:
the long

readULong

public java.math.BigInteger readULong(byte[] ba,
                                      int pos,
                                      boolean byteSwap)
This method will use eight bytes from the given byte array starting at position to create an unsigned long (stored in a BigInteger).

Parameters:
ba - the byte array
pos - the position to start reading
byteSwap - whether or not the bytes need to be swapped
Returns:
the unsigned long

readULong

public java.math.BigInteger readULong(byte[] ba,
                                      int pos)
This method will use eight bytes from the given byte array starting at position to create an unsigned long (stored in a BigInteger).

Parameters:
ba - the byte array
pos - the position to start reading
Returns:
the unsigned long

readFloat

public float readFloat(byte[] ba,
                       int pos,
                       boolean byteSwap)
This method will use four bytes from the given byte array starting at position to create a float.

Parameters:
ba - the byte array
pos - the position to start reading
byteSwap - whether or not the bytes need to be swapped
Returns:
the float

readFloat

public float readFloat(byte[] ba,
                       int pos)
This method will use four bytes from the given byte array starting at position to create a float.

Parameters:
ba - the byte array
pos - the position to start reading
Returns:
the float

readDouble

public double readDouble(byte[] ba,
                         int pos,
                         boolean byteSwap)
This method will use eight bytes from the given byte array starting at position to create a double.

Parameters:
ba - the byte array
pos - the position to start reading
byteSwap - whether or not the bytes need to be swapped
Returns:
the double

readDouble

public double readDouble(byte[] ba,
                         int pos)
This method will use eight bytes from the given byte array starting at position to create a double.

Parameters:
ba - the byte array
pos - the position to start reading
Returns:
the double

readDecimal

public PDMDecimal readDecimal(byte[] ba,
                              int pos,
                              boolean byteSwap)
This method will use nine bytes from the given byte array starting at position to create a PDMDecimal.

Parameters:
ba - the byte array
pos - the position to start reading
byteSwap - whether or not the bytes need to be swapped
Returns:
the PDMDecimal

readDecimal

public PDMDecimal readDecimal(byte[] ba,
                              int pos)
This method will use eight bytes from the given byte array starting at position to create a PDMDecimal.

Parameters:
ba - the byte array
pos - the position to start reading
Returns:
the PDMDecimal

readTimestamp

public PDMTimestamp readTimestamp(byte[] ba,
                                  int pos,
                                  boolean byteSwap)
This method will use eight bytes from the given byte array starting at position to create a PDMTimestamp.

Parameters:
ba - the byte array
pos - the position to start reading
byteSwap - whether or not the bytes need to be swapped
Returns:
the PDMTimestamp

readTimestamp

public PDMTimestamp readTimestamp(byte[] ba,
                                  int pos)
This method will use eight bytes from the given byte array starting at position to create a PDMTimestamp.

Parameters:
ba - the byte array
pos - the position to start reading
Returns:
the PDMTimestamp

readString

public java.lang.String readString(byte[] ba,
                                   int pos,
                                   int len)
This method will read the specified len at position pos from the byte array and create a String expecting the String to end with a byte 0

Parameters:
ba - the byte array
pos - the position to start reading
len - the length of the string in bytes
Returns:
the String

readUnicode

public java.lang.String readUnicode(byte[] ba,
                                    int pos,
                                    int len,
                                    java.lang.String charSet)
                             throws java.io.UnsupportedEncodingException
This method will read the specified len at position pos from the byte array and create a unicode String expecting the String to end with a byte 0

Parameters:
ba - the byte array
pos - the position to start reading
len - the length of the string in bytes
charSet - the character set
Returns:
the String
Throws:
java.io.UnsupportedEncodingException

readUnicode

public java.lang.String readUnicode(byte[] ba,
                                    int pos,
                                    int len)
                             throws java.io.UnsupportedEncodingException
This method will read the specified len at position pos from the byte array and create a UTF-8 unicode String expecting the String to end with a byte 0

Parameters:
ba - the byte array
pos - the position to start reading
len - the length of the string in bytes
Returns:
the String
Throws:
java.io.UnsupportedEncodingException

readByteArray

public void readByteArray(byte[] ba,
                          int pos,
                          byte[] destByteArray)
Copies bytes from the source byte array (ba) into the destination byte array

Parameters:
ba - the byte array
pos - the position to start reading
destByteArray - the destination byte array

readByteArray

public void readByteArray(byte[] ba,
                          int pos,
                          byte[] destByteArray,
                          int copyLen)
Copies bytes from the source byte array (ba) into the destination byte array

Parameters:
ba - the byte array
pos - the position to start reading
destByteArray - the destination byte array
copyLen - the number of bytes to copy

readByteArray

public byte[] readByteArray(byte[] ba,
                            int pos,
                            int length)
Creates a new byte array from the source byte array (ba) at position for the given length

Parameters:
ba - the byte array
pos - the position to start reading
length - the length in bytes to copy
Returns:
the new byte array


All of the documentation and software included in this and any other Informatica Inc "Ultra Messaging" Release is Copyright (C) 2004-2014, Informatica Corporation. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted only as covered by the terms of a valid software license agreement with 29West Inc. Copyright © 2004-2014, Informatica, Inc. All Rights Reserved.