net.sf.asyncobjects.io
Class BinaryDataBuilder

java.lang.Object
  extended by net.sf.asyncobjects.io.BinaryDataBuilder

public final class BinaryDataBuilder
extends Object

Binary data builder, this is a utility class that could be used to build binary data from datatypes. The builder accumulates appends and than can be used to create binary data basing on them.

Note this class is not a thread-safe.

Author:
const

Constructor Summary
BinaryDataBuilder()
           
 
Method Summary
 void append(BinaryData data)
          Append binary data
 void append(byte data)
          Append 8-bit byte
 void append(double data)
          Append 64-bit IEEE float
 void append(float data)
          Append 32-bit IEEE float
 void append(int data)
          Append 32-bit integer
 void append(long data)
          Append 64-bit integer
 void append(short data)
          Append 16-bit integer
 void appendASCII(char data)
          Append character in ascii form
 void appendASCII(String data)
          Append string in ASCII form.
 BinaryData toBinaryData()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BinaryDataBuilder

public BinaryDataBuilder()
Method Detail

appendASCII

public void appendASCII(String data)
Append string in ASCII form.

Parameters:
data - a string to append

appendASCII

public void appendASCII(char data)
Append character in ascii form

Parameters:
data - a data to append

append

public void append(BinaryData data)
Append binary data

Parameters:
data - a data to append

append

public void append(byte data)
Append 8-bit byte

Parameters:
data - a data to append

append

public void append(short data)
Append 16-bit integer

Parameters:
data - a data to append

append

public void append(int data)
Append 32-bit integer

Parameters:
data - a data to append

append

public void append(long data)
Append 64-bit integer

Parameters:
data - a data to append

append

public void append(float data)
Append 32-bit IEEE float

Parameters:
data - a data to append

append

public void append(double data)
Append 64-bit IEEE float

Parameters:
data - a data to append

toBinaryData

public BinaryData toBinaryData()
Returns:
a binary data that is result of executing append operators.


Copyright 2002-2007 Constantine Plotnikov. All Rights Reserved.