org.npsnet.xrti.utilities
Class HLAEncodingInputStream

java.lang.Object
  extended byjava.io.InputStream
      extended byjava.io.FilterInputStream
          extended byjava.io.DataInputStream
              extended byorg.npsnet.xrti.utilities.HLAEncodingInputStream
All Implemented Interfaces:
java.io.DataInput

public class HLAEncodingInputStream
extends java.io.DataInputStream

An input stream with methods for reading values using standard HLA encoding.

Author:
Andrzej Kapolka

Field Summary
private  int alignment
          The alignment value.
 
Fields inherited from class java.io.DataInputStream
 
Fields inherited from class java.io.FilterInputStream
in
 
Fields inherited from class java.io.InputStream
 
Constructor Summary
HLAEncodingInputStream(java.io.InputStream is)
          Constructor.
HLAEncodingInputStream(java.io.InputStream is, int pAlignment)
          Constructor.
 
Method Summary
 int getAlignment()
          Returns the alignment value.
 char readHLAASCIIchar()
          Reads an ASCII character.
 java.lang.String readHLAASCIIstring()
          Reads an ASCII string.
 boolean readHLAboolean()
          Reads a boolean value.
 byte readHLAbyte()
          Reads a byte.
 float readHLAfloat32BE()
          Reads a thirty-two bit float with big-endian byte ordering.
 float readHLAfloat32LE()
          Reads a thirty-two bit float with little-endian byte ordering.
 double readHLAfloat64BE()
          Reads a sixty-four bit float with big-endian byte ordering.
 double readHLAfloat64LE()
          Reads a sixty-four bit float with little-endian byte ordering.
 short readHLAinteger16BE()
          Reads a sixteen bit integer with big-endian byte ordering.
 short readHLAinteger16LE()
          Reads a sixteen bit integer with little-endian byte ordering.
 int readHLAinteger32BE()
          Reads a thirty-two bit integer with big-endian byte ordering.
 int readHLAinteger32LE()
          Reads a thirty-two bit integer with little-endian byte ordering.
 long readHLAinteger64BE()
          Reads a sixty-four bit integer with big-endian byte ordering.
 long readHLAinteger64LE()
          Reads a sixty-four bit integer with little-endian byte ordering.
 byte readHLAoctet()
          Reads an octet.
 short readHLAoctetPairBE()
          Reads a sixteen bit octet pair with big-endian byte ordering.
 short readHLAoctetPairLE()
          Reads a sixteen bit octet pair with little-endian byte ordering.
 byte[] readHLAopaqueData()
          Reads an array of opaque data.
 char readHLAunicodeChar()
          Reads a Unicode character.
 java.lang.String readHLAunicodeString()
          Reads a Unicode string.
 void setAlignment(int pAlignment)
          Sets the alignment value.
 
Methods inherited from class java.io.DataInputStream
read, read, readBoolean, readByte, readDouble, readFloat, readFully, readFully, readChar, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, readUTF, skipBytes
 
Methods inherited from class java.io.FilterInputStream
available, close, mark, markSupported, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

alignment

private int alignment
The alignment value.

Constructor Detail

HLAEncodingInputStream

public HLAEncodingInputStream(java.io.InputStream is)
Constructor. The initial alignment will be set to 0.

Parameters:
is - the InputStream to read from

HLAEncodingInputStream

public HLAEncodingInputStream(java.io.InputStream is,
                              int pAlignment)
Constructor.

Parameters:
is - the InputStream to read from
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

readHLAinteger16BE

public short readHLAinteger16BE()
                         throws java.io.IOException
Reads a sixteen bit integer with big-endian byte ordering.

Returns:
the value read
Throws:
java.io.IOException - if an error occurs

readHLAinteger32BE

public int readHLAinteger32BE()
                       throws java.io.IOException
Reads a thirty-two bit integer with big-endian byte ordering.

Returns:
the value read
Throws:
java.io.IOException - if an error occurs

readHLAinteger64BE

public long readHLAinteger64BE()
                        throws java.io.IOException
Reads a sixty-four bit integer with big-endian byte ordering.

Returns:
the value read
Throws:
java.io.IOException - if an error occurs

readHLAfloat32BE

public float readHLAfloat32BE()
                       throws java.io.IOException
Reads a thirty-two bit float with big-endian byte ordering.

Returns:
the value read
Throws:
java.io.IOException - if an error occurs

readHLAfloat64BE

public double readHLAfloat64BE()
                        throws java.io.IOException
Reads a sixty-four bit float with big-endian byte ordering.

Returns:
the value read
Throws:
java.io.IOException - if an error occurs

readHLAoctetPairBE

public short readHLAoctetPairBE()
                         throws java.io.IOException
Reads a sixteen bit octet pair with big-endian byte ordering.

Returns:
the value read
Throws:
java.io.IOException - if an error occurs

readHLAinteger16LE

public short readHLAinteger16LE()
                         throws java.io.IOException
Reads a sixteen bit integer with little-endian byte ordering.

Returns:
the value read
Throws:
java.io.IOException - if an error occurs

readHLAinteger32LE

public int readHLAinteger32LE()
                       throws java.io.IOException
Reads a thirty-two bit integer with little-endian byte ordering.

Returns:
the value read
Throws:
java.io.IOException - if an error occurs

readHLAinteger64LE

public long readHLAinteger64LE()
                        throws java.io.IOException
Reads a sixty-four bit integer with little-endian byte ordering.

Returns:
the value read
Throws:
java.io.IOException - if an error occurs

readHLAfloat32LE

public float readHLAfloat32LE()
                       throws java.io.IOException
Reads a thirty-two bit float with little-endian byte ordering.

Returns:
the value read
Throws:
java.io.IOException - if an error occurs

readHLAfloat64LE

public double readHLAfloat64LE()
                        throws java.io.IOException
Reads a sixty-four bit float with little-endian byte ordering.

Returns:
the value read
Throws:
java.io.IOException - if an error occurs

readHLAoctetPairLE

public short readHLAoctetPairLE()
                         throws java.io.IOException
Reads a sixteen bit octet pair with little-endian byte ordering.

Returns:
the value read
Throws:
java.io.IOException - if an error occurs

readHLAoctet

public byte readHLAoctet()
                  throws java.io.IOException
Reads an octet.

Returns:
the value read
Throws:
java.io.IOException - if an error occurs

readHLAASCIIchar

public char readHLAASCIIchar()
                      throws java.io.IOException
Reads an ASCII character.

Returns:
the value read
Throws:
java.io.IOException - if an error occurs

readHLAunicodeChar

public char readHLAunicodeChar()
                        throws java.io.IOException
Reads a Unicode character.

Returns:
the value read
Throws:
java.io.IOException - if an error occurs

readHLAbyte

public byte readHLAbyte()
                 throws java.io.IOException
Reads a byte.

Returns:
the value read
Throws:
java.io.IOException - if an error occurs

readHLAboolean

public boolean readHLAboolean()
                       throws java.io.IOException
Reads a boolean value.

Returns:
the value read
Throws:
java.io.IOException - if an error occurs

readHLAASCIIstring

public java.lang.String readHLAASCIIstring()
                                    throws java.io.IOException
Reads an ASCII string.

Returns:
the value read
Throws:
java.io.IOException - if an error occurs

readHLAunicodeString

public java.lang.String readHLAunicodeString()
                                      throws java.io.IOException
Reads a Unicode string.

Returns:
the value read
Throws:
java.io.IOException - if an error occurs

readHLAopaqueData

public byte[] readHLAopaqueData()
                         throws java.io.IOException
Reads an array of opaque data.

Returns:
the value read
Throws:
java.io.IOException - if an error occurs