com.latencybusters.pdm
Class PDMSerializer

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

public class PDMSerializer
extends java.lang.Object

Used to serialize a type into an array of bytes


Constructor Summary
PDMSerializer()
           
 
Method Summary
 int writeBoolean(byte[] ba, int pos, boolean b)
          Writes the boolean as 1 byte into the byte array at position
 int writeByte(byte[] byteArr, int pos, byte b)
          Writes the byte as 1 byte into the byte array at position
 int writeByteArray(byte[] ba, int pos, byte[] sourceByteArray)
          Copies the source byte array into the byte array at position
 int writeDecimal(byte[] ba, int pos, PDMDecimal dec)
          Writes the PDMDecimal as 9 bytes into the byte array at position
 int writeDouble(byte[] ba, int pos, double d)
          Writes the double as 8 bytes into the byte array at position
 int writeFloat(byte[] ba, int pos, float f)
          Writes the float as 4 bytes into the byte array at position
 int writeInt(byte[] ba, int pos, int value)
          Writes the int as 4 bytes into the byte array at position
 int writeLong(byte[] ba, int pos, long l)
          Writes the long as 8 bytes into the byte array at position
 int writeShort(byte[] ba, int pos, short s)
          * Writes the short as 2 bytes into the byte array at position
 int writeString(byte[] ba, int pos, java.lang.String value)
          Writes the non-null String into the byte array at position and appends a 0 byte after the String
 int writeTimestamp(byte[] ba, int pos, PDMTimestamp ts)
          Writes the PDMTimestamp as 8 bytes into the byte array at position
 int writeUByte(byte[] ba, int pos, short b)
          Writes the unsigned byte (short) as 1 byte into the byte array at position
 int writeUInt(byte[] ba, int pos, long value)
          Writes the unsigned int (long) as 4 bytes into the byte array at position
 int writeULong(byte[] ba, int pos, java.math.BigInteger bi)
          Writes the unsigned long (BigInteger) as 8 bytes into the byte array at position
 int writeUnicode(byte[] ba, int pos, java.lang.String value)
          Writes the non-null unicode String into the byte array as UTF-8 at position and appends a 0 byte after the String
 int writeUnicode(byte[] ba, int pos, java.lang.String value, java.lang.String charSet)
          Writes the non-null unicode String into the byte array at position and appends a 0 byte after the String
 int writeUShort(byte[] ba, int pos, int i)
          Writes the unsigned short (int) as 2 bytes into the byte array at position
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PDMSerializer

public PDMSerializer()
Method Detail

writeBoolean

public int writeBoolean(byte[] ba,
                        int pos,
                        boolean b)
Writes the boolean as 1 byte into the byte array at position

Parameters:
ba - the byte array
pos - the starting position
b - the bool to write
Returns:
the updated position in the byte array after the write

writeByte

public int writeByte(byte[] byteArr,
                     int pos,
                     byte b)
Writes the byte as 1 byte into the byte array at position

Parameters:
byteArr -
pos - the starting position
b - the byte to write
Returns:
the updated position in the byte array after the write

writeUByte

public int writeUByte(byte[] ba,
                      int pos,
                      short b)
Writes the unsigned byte (short) as 1 byte into the byte array at position

Parameters:
ba - the byte array
pos - the starting position
b - the ubyte (as a short) to write
Returns:
the updated position in the byte array after the write

writeShort

public int writeShort(byte[] ba,
                      int pos,
                      short s)
* Writes the short as 2 bytes into the byte array at position

Parameters:
ba - the byte array
pos - the starting position
s - the short to write
Returns:
the updated position in the byte array after the write

writeUShort

public int writeUShort(byte[] ba,
                       int pos,
                       int i)
Writes the unsigned short (int) as 2 bytes into the byte array at position

Parameters:
ba - the byte array
pos - the starting position
i - the ushort (as an int) to write
Returns:
the updated position in the byte array after the write

writeInt

public int writeInt(byte[] ba,
                    int pos,
                    int value)
Writes the int as 4 bytes into the byte array at position

Parameters:
ba - the byte array
pos - the starting position
value - the int to write
Returns:
the updated position in the byte array after the write

writeUInt

public int writeUInt(byte[] ba,
                     int pos,
                     long value)
Writes the unsigned int (long) as 4 bytes into the byte array at position

Parameters:
ba - the byte array
pos - the starting position
value - the uint (as a long) to write
Returns:
the updated position in the byte array after the write

writeLong

public int writeLong(byte[] ba,
                     int pos,
                     long l)
Writes the long as 8 bytes into the byte array at position

Parameters:
ba - the byte array
pos - the starting position
l - the long to write
Returns:
the updated position in the byte array after the write

writeULong

public int writeULong(byte[] ba,
                      int pos,
                      java.math.BigInteger bi)
Writes the unsigned long (BigInteger) as 8 bytes into the byte array at position

Parameters:
ba - the byte array
pos - the starting position
bi - the ulong (as a BigInteger) to write
Returns:
the updated position in the byte array after the write

writeFloat

public int writeFloat(byte[] ba,
                      int pos,
                      float f)
Writes the float as 4 bytes into the byte array at position

Parameters:
ba - the byte array
pos - the starting position
f - the float to write
Returns:
the updated position in the byte array after the write

writeDouble

public int writeDouble(byte[] ba,
                       int pos,
                       double d)
Writes the double as 8 bytes into the byte array at position

Parameters:
ba - the byte array
pos - the starting position
d - the double to write
Returns:
the updated position in the byte array after the write

writeDecimal

public int writeDecimal(byte[] ba,
                        int pos,
                        PDMDecimal dec)
Writes the PDMDecimal as 9 bytes into the byte array at position

Parameters:
ba - the byte array
pos - the starting position
dec - the PDMDecimal to write
Returns:
the updated position in the byte array after the write

writeTimestamp

public int writeTimestamp(byte[] ba,
                          int pos,
                          PDMTimestamp ts)
Writes the PDMTimestamp as 8 bytes into the byte array at position

Parameters:
ba - the byte array
pos - the starting position
ts - the PDMTimestamp to write
Returns:
the updated position in the byte array after the write

writeString

public int writeString(byte[] ba,
                       int pos,
                       java.lang.String value)
Writes the non-null String into the byte array at position and appends a 0 byte after the String

Parameters:
ba - the byte array
pos - the starting position
value - the String to write
Returns:
the updated position in the byte array after the write

writeUnicode

public int writeUnicode(byte[] ba,
                        int pos,
                        java.lang.String value,
                        java.lang.String charSet)
                 throws java.io.UnsupportedEncodingException
Writes the non-null unicode String into the byte array at position and appends a 0 byte after the String

Parameters:
ba - the byte array
pos - the starting position
value - the Unicode String to write
charSet - the character set
Returns:
the updated position in the byte array after the write
Throws:
java.io.UnsupportedEncodingException

writeUnicode

public int writeUnicode(byte[] ba,
                        int pos,
                        java.lang.String value)
                 throws java.io.UnsupportedEncodingException
Writes the non-null unicode String into the byte array as UTF-8 at position and appends a 0 byte after the String

Parameters:
ba - the byte array
pos - the starting position
value - the Unicode String to write
Returns:
the updated position in the byte array after the write
Throws:
java.io.UnsupportedEncodingException

writeByteArray

public int writeByteArray(byte[] ba,
                          int pos,
                          byte[] sourceByteArray)
Copies the source byte array into the byte array at position

Parameters:
ba - the byte array
pos - the starting position
sourceByteArray - the source byte array
Returns:
the updated position in the byte array after the write


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.