org.npsnet.xrti.utilities
Class HLAEncodingOutputStream

java.lang.Object
  extended byjava.io.OutputStream
      extended byjava.io.FilterOutputStream
          extended byjava.io.DataOutputStream
              extended byorg.npsnet.xrti.utilities.HLAEncodingOutputStream
All Implemented Interfaces:
java.io.DataOutput

public class HLAEncodingOutputStream
extends java.io.DataOutputStream

An output stream with methods for writing values using standard HLA encoding.

Author:
Andrzej Kapolka

Field Summary
private  int alignment
          The alignment value.
 
Fields inherited from class java.io.DataOutputStream
written
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
HLAEncodingOutputStream(java.io.OutputStream os)
          Constructor.
HLAEncodingOutputStream(java.io.OutputStream os, int pAlignment)
          Constructor.
 
Method Summary
 int getAlignment()
          Returns the alignment value.
 void setAlignment(int pAlignment)
          Sets the alignment value.
 void writeHLAASCIIchar(char value)
          Writes an ASCII character.
 void writeHLAASCIIstring(java.lang.String value)
          Writes an ASCII string.
 void writeHLAboolean(boolean value)
          Writes a boolean value.
 void writeHLAbyte(byte value)
          Writes a byte.
 void writeHLAfloat32BE(float value)
          Writes a thirty-two bit float with big-endian byte ordering.
 void writeHLAfloat32LE(float value)
          Writes a thirty-two bit float with little-endian byte ordering.
 void writeHLAfloat64BE(double value)
          Writes a sixty-four bit float with big-endian byte ordering.
 void writeHLAfloat64LE(double value)
          Writes a sixty-four bit float with little-endian byte ordering.
 void writeHLAinteger16BE(short value)
          Writes a sixteen bit integer with big-endian byte ordering.
 void writeHLAinteger16LE(short value)
          Writes a sixteen bit integer with little-endian byte ordering.
 void writeHLAinteger32BE(int value)
          Writes a thirty-two bit integer with big-endian byte ordering.
 void writeHLAinteger32LE(int value)
          Writes a thirty-two bit integer with little-endian byte ordering.
 void writeHLAinteger64BE(long value)
          Writes a sixty-four bit integer with big-endian byte ordering.
 void writeHLAinteger64LE(long value)
          Writes a sixty-four bit integer with little-endian byte ordering.
 void writeHLAoctet(byte value)
          Writes an octet.
 void writeHLAoctetPairBE(short value)
          Writes a sixteen bit octet pair with big-endian byte ordering.
 void writeHLAoctetPairLE(short value)
          Writes a sixteen bit octet pair with little-endian byte ordering.
 void writeHLAopaqueData(byte[] value)
          Writes an array of opaque data.
 void writeHLAunicodeChar(char value)
          Writes a Unicode character.
 void writeHLAunicodeString(java.lang.String value)
          Writes a Unicode string.
 
Methods inherited from class java.io.DataOutputStream
flush, size, write, write, writeBoolean, writeByte, writeBytes, writeDouble, writeFloat, writeChar, writeChars, writeInt, writeLong, writeShort, writeUTF
 
Methods inherited from class java.io.FilterOutputStream
close, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.io.DataOutput
write
 

Field Detail

alignment

private int alignment
The alignment value.

Constructor Detail

HLAEncodingOutputStream

public HLAEncodingOutputStream(java.io.OutputStream os)
Constructor. The initial alignment will be set to 0.

Parameters:
os - the OutputStream to write to

HLAEncodingOutputStream

public HLAEncodingOutputStream(java.io.OutputStream os,
                               int pAlignment)
Constructor.

Parameters:
os - the OutputStream to write to
pAlignment - the initial alignment value
Method Detail

setAlignment

public void setAlignment(int pAlignment)
Sets the alignment value.

Parameters:
pAlignment - the new alignment value

getAlignment

public int getAlignment()
Returns the alignment value.

Returns:
the current alignment value

writeHLAinteger16BE

public void writeHLAinteger16BE(short value)
                         throws java.io.IOException
Writes a sixteen bit integer with big-endian byte ordering.

Parameters:
value - the value to write
Throws:
java.io.IOException - if an error occurs

writeHLAinteger32BE

public void writeHLAinteger32BE(int value)
                         throws java.io.IOException
Writes a thirty-two bit integer with big-endian byte ordering.

Parameters:
value - the value to write
Throws:
java.io.IOException - if an error occurs

writeHLAinteger64BE

public void writeHLAinteger64BE(long value)
                         throws java.io.IOException
Writes a sixty-four bit integer with big-endian byte ordering.

Parameters:
value - the value to write
Throws:
java.io.IOException - if an error occurs

writeHLAfloat32BE

public void writeHLAfloat32BE(float value)
                       throws java.io.IOException
Writes a thirty-two bit float with big-endian byte ordering.

Parameters:
value - the value to write
Throws:
java.io.IOException - if an error occurs

writeHLAfloat64BE

public void writeHLAfloat64BE(double value)
                       throws java.io.IOException
Writes a sixty-four bit float with big-endian byte ordering.

Parameters:
value - the value to write
Throws:
java.io.IOException - if an error occurs

writeHLAoctetPairBE

public void writeHLAoctetPairBE(short value)
                         throws java.io.IOException
Writes a sixteen bit octet pair with big-endian byte ordering.

Parameters:
value - the value to write
Throws:
java.io.IOException - if an error occurs

writeHLAinteger16LE

public void writeHLAinteger16LE(short value)
                         throws java.io.IOException
Writes a sixteen bit integer with little-endian byte ordering.

Parameters:
value - the value to write
Throws:
java.io.IOException - if an error occurs

writeHLAinteger32LE

public void writeHLAinteger32LE(int value)
                         throws java.io.IOException
Writes a thirty-two bit integer with little-endian byte ordering.

Parameters:
value - the value to write
Throws:
java.io.IOException - if an error occurs

writeHLAinteger64LE

public void writeHLAinteger64LE(long value)
                         throws java.io.IOException
Writes a sixty-four bit integer with little-endian byte ordering.

Parameters:
value - the value to write
Throws:
java.io.IOException - if an error occurs

writeHLAfloat32LE

public void writeHLAfloat32LE(float value)
                       throws java.io.IOException
Writes a thirty-two bit float with little-endian byte ordering.

Parameters:
value - the value to write
Throws:
java.io.IOException - if an error occurs

writeHLAfloat64LE

public void writeHLAfloat64LE(double value)
                       throws java.io.IOException
Writes a sixty-four bit float with little-endian byte ordering.

Parameters:
value - the value to write
Throws:
java.io.IOException - if an error occurs

writeHLAoctetPairLE

public void writeHLAoctetPairLE(short value)
                         throws java.io.IOException
Writes a sixteen bit octet pair with little-endian byte ordering.

Parameters:
value - the value to write
Throws:
java.io.IOException - if an error occurs

writeHLAoctet

public void writeHLAoctet(byte value)
                   throws java.io.IOException
Writes an octet.

Parameters:
value - the value to write
Throws:
java.io.IOException - if an error occurs

writeHLAASCIIchar

public void writeHLAASCIIchar(char value)
                       throws java.io.IOException
Writes an ASCII character.

Parameters:
value - the value to write
Throws:
java.io.IOException - if an error occurs

writeHLAunicodeChar

public void writeHLAunicodeChar(char value)
                         throws java.io.IOException
Writes a Unicode character.

Parameters:
value - the value to write
Throws:
java.io.IOException - if an error occurs

writeHLAbyte

public void writeHLAbyte(byte value)
                  throws java.io.IOException
Writes a byte.

Parameters:
value - the value to write
Throws:
java.io.IOException - if an error occurs

writeHLAboolean

public void writeHLAboolean(boolean value)
                     throws java.io.IOException
Writes a boolean value.

Parameters:
value - the value to write
Throws:
java.io.IOException - if an error occurs

writeHLAASCIIstring

public void writeHLAASCIIstring(java.lang.String value)
                         throws java.io.IOException
Writes an ASCII string.

Parameters:
value - the value to write
Throws:
java.io.IOException - if an error occurs

writeHLAunicodeString

public void writeHLAunicodeString(java.lang.String value)
                           throws java.io.IOException
Writes a Unicode string.

Parameters:
value - the value to write
Throws:
java.io.IOException - if an error occurs

writeHLAopaqueData

public void writeHLAopaqueData(byte[] value)
                        throws java.io.IOException
Writes an array of opaque data.

Parameters:
value - the value to write
Throws:
java.io.IOException - if an error occurs