UM Java API 6.17.1

- Main Page
- Related Pages
- Classes

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | List of all members
com.latencybusters.pdm.PDMSerializer Class Reference

## Public Member Functions
int | writeBoolean (byte[] ba, int pos, final boolean b)
int | writeByte (byte[] byteArr, int pos, final byte b)
int | writeUByte (byte[] ba, int pos, final short b)
int | writeShort (byte[] ba, int pos, final short s)
int | writeUShort (byte[] ba, int pos, final int i)
int | writeInt (byte[] ba, int pos, final int value)
int | writeUInt (byte[] ba, int pos, final long value)
int | writeLong (byte[] ba, int pos, final long l)
int | writeULong (byte[] ba, int pos, final BigInteger bi)
int | writeFloat (byte[] ba, int pos, final float f)
int | writeDouble (byte[] ba, int pos, final double d)
int | writeDecimal (byte[] ba, int pos, final PDMDecimal dec)
int | writeTimestamp (byte[] ba, int pos, final PDMTimestamp ts)
int | writeString (byte[] ba, int pos, final String value)
int | writeUnicode (byte[] ba, int pos, final String value, String charSet) throws UnsupportedEncodingException
int | writeUnicode (byte[] ba, int pos, final String value) throws UnsupportedEncodingException
int | writeByteArray (byte[] ba, int pos, byte[] sourceByteArray)

## Detailed Description

Used to serialize a type into an array of bytes

Author
  jfugitt

## Member Function Documentation

int com.latencybusters.pdm.PDMSerializer.writeBoolean | ( | byte[] | ba,
|  | int | pos,
|  | final 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

Referenced by com.latencybusters.pdm.PDMField.setValue(), com.latencybusters.pdm.PDMFieldInfo.toBytes(), and com.latencybusters.pdm.PDMDefinition.toBytes().

int com.latencybusters.pdm.PDMSerializer.writeByte | ( | byte[] | byteArr,
|  | int | pos,
|  | final 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

Referenced by com.latencybusters.pdm.PDMField.setValue(), com.latencybusters.pdm.PDMDefinition.toBytes(), com.latencybusters.pdm.PDMSerializer.writeDecimal(), com.latencybusters.pdm.PDMSerializer.writeString(), and com.latencybusters.pdm.PDMSerializer.writeUnicode().

int com.latencybusters.pdm.PDMSerializer.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

Referenced by com.latencybusters.pdm.PDMMessage.getMessageLen(), com.latencybusters.pdm.PDMField.setValue(), com.latencybusters.pdm.PDMSerializer.writeString(), and com.latencybusters.pdm.PDMSerializer.writeUnicode().

int com.latencybusters.pdm.PDMSerializer.writeDecimal | ( | byte[] | ba,
|  | int | pos,
|  | final 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

References com.latencybusters.pdm.PDMSerializer.writeByte(), and com.latencybusters.pdm.PDMSerializer.writeLong().

Referenced by com.latencybusters.pdm.PDMField.setValue().

int com.latencybusters.pdm.PDMSerializer.writeDouble | ( | byte[] | ba,
|  | int | pos,
|  | final 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

References com.latencybusters.pdm.PDMSerializer.writeLong().

Referenced by com.latencybusters.pdm.PDMField.setValue().

int com.latencybusters.pdm.PDMSerializer.writeFloat | ( | byte[] | ba,
|  | int | pos,
|  | final 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

References com.latencybusters.pdm.PDMSerializer.writeInt().

Referenced by com.latencybusters.pdm.PDMField.setValue().

int com.latencybusters.pdm.PDMSerializer.writeInt | ( | byte[] | ba,
|  | int | pos,
|  | final 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

Referenced by com.latencybusters.pdm.PDMField.setValue(), com.latencybusters.pdm.PDMFieldInfo.toBytes(), com.latencybusters.pdm.PDMDefinition.toBytes(), com.latencybusters.pdm.PDMSerializer.writeFloat(), and com.latencybusters.pdm.PDMSerializer.writeTimestamp().

int com.latencybusters.pdm.PDMSerializer.writeLong | ( | byte[] | ba,
|  | int | pos,
|  | final 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

Referenced by com.latencybusters.pdm.PDMField.setValue(), com.latencybusters.pdm.PDMSerializer.writeDecimal(), and com.latencybusters.pdm.PDMSerializer.writeDouble().

int com.latencybusters.pdm.PDMSerializer.writeShort | ( | byte[] | ba,
|  | int | pos,
|  | final 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

Referenced by com.latencybusters.pdm.PDMField.setValue(), and com.latencybusters.pdm.PDMFieldInfo.toBytes().

int com.latencybusters.pdm.PDMSerializer.writeString | ( | byte[] | ba,
|  | int | pos,
|  | final 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

References com.latencybusters.pdm.PDMSerializer.writeByte(), and com.latencybusters.pdm.PDMSerializer.writeByteArray().

Referenced by com.latencybusters.pdm.PDMField.setValue(), and com.latencybusters.pdm.PDMFieldInfo.toBytes().

int com.latencybusters.pdm.PDMSerializer.writeTimestamp | ( | byte[] | ba,
|  | int | pos,
|  | final 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

References com.latencybusters.pdm.PDMSerializer.writeInt().

Referenced by com.latencybusters.pdm.PDMField.setValue().

int com.latencybusters.pdm.PDMSerializer.writeUByte | ( | byte[] | ba,
|  | int | pos,
|  | final 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

Referenced by com.latencybusters.pdm.PDMField.setValue().

int com.latencybusters.pdm.PDMSerializer.writeUInt | ( | byte[] | ba,
|  | int | pos,
|  | final 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

Referenced by com.latencybusters.pdm.PDMField.setValue().

int com.latencybusters.pdm.PDMSerializer.writeULong | ( | byte [] | ba,
|  | int | pos,
|  | final 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

Referenced by com.latencybusters.pdm.PDMField.setValue().

int com.latencybusters.pdm.PDMSerializer.writeUnicode | ( | byte[] | ba,
|  | int | pos,
|  | final String | value,
|  | String | charSet
| ) |  | throws 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

Exceptions

  UnsupportedEncodingException |

References com.latencybusters.pdm.PDMSerializer.writeByte(), and com.latencybusters.pdm.PDMSerializer.writeByteArray().

Referenced by com.latencybusters.pdm.PDMField.setValue(), and com.latencybusters.pdm.PDMSerializer.writeUnicode().

int com.latencybusters.pdm.PDMSerializer.writeUnicode | ( | byte[] | ba,
|  | int | pos,
|  | final String | value
| ) |  | throws 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

Exceptions

  UnsupportedEncodingException |

References com.latencybusters.pdm.PDMSerializer.writeUnicode().

int com.latencybusters.pdm.PDMSerializer.writeUShort | ( | byte[] | ba,
|  | int | pos,
|  | final 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

Referenced by com.latencybusters.pdm.PDMField.setValue().

The documentation for this class was generated from the following file:

- PDMSerializer.java