com.fernsroth.easyio
Class EasyIOInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FilterInputStream
          extended by com.fernsroth.easyio.EasyIOInputStream
All Implemented Interfaces:
IInputStream, java.io.Closeable

public class EasyIOInputStream
extends java.io.FilterInputStream
implements IInputStream

input stream for reading and writing binary data.

Author:
Joseph M. Ferner (Near Infinity Corporation)

Field Summary
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
EasyIOInputStream(IInputStream in)
          constructor.
EasyIOInputStream(java.io.InputStream in)
          constructor.
 
Method Summary
<T> T
read(T obj)
          reads in a object.
 int readBits(int bits)
           
 int readBits(int bits, byte[] buffer)
          read the specified number of bits from the input stream.
 int readBits(int bits, byte[] buffer, int offset, int length)
          read the specified number of bits from the input stream (the bits will be left aligned within the buffer).
 long readINT64()
          reads a little-endien int64.
 int readUINT16()
          reads a little-endien uint16.
 long readUINT32()
          reads a little-endien uint32.
 java.math.BigInteger readUINT64()
          reads a little-endien uint64.
 int readUINT8()
          reads a uint8.
 
Methods inherited from class java.io.FilterInputStream
available, close, mark, markSupported, read, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.fernsroth.easyio.IInputStream
read, read
 

Constructor Detail

EasyIOInputStream

public EasyIOInputStream(java.io.InputStream in)
constructor.

Parameters:
in - the input stream to wrap.

EasyIOInputStream

public EasyIOInputStream(IInputStream in)
constructor.

Parameters:
in - the input stream.
Method Detail

read

public <T> T read(T obj)
       throws EasyIOException,
              java.io.IOException
reads in a object.

Specified by:
read in interface IInputStream
Type Parameters:
T - the object type.
Parameters:
obj - the object to read data into.
Returns:
the read in object.
Throws:
EasyIOException
java.io.IOException

readINT64

public long readINT64()
               throws java.io.IOException
reads a little-endien int64.

Returns:
the int.
Throws:
java.io.IOException

readUINT64

public java.math.BigInteger readUINT64()
                                throws java.io.IOException
reads a little-endien uint64.

Returns:
the int.
Throws:
java.io.IOException
java.io.IOException

readUINT32

public long readUINT32()
                throws java.io.IOException
reads a little-endien uint32.

Returns:
the int.
Throws:
java.io.IOException

readUINT16

public int readUINT16()
               throws java.io.IOException
reads a little-endien uint16.

Returns:
the int.
Throws:
java.io.IOException

readUINT8

public int readUINT8()
              throws java.io.IOException
reads a uint8.

Returns:
the int.
Throws:
java.io.IOException

readBits

public int readBits(int bits,
                    byte[] buffer)
             throws java.io.IOException
read the specified number of bits from the input stream.

Parameters:
buffer - the data array to read it into.
bits - the number of bits to read.
Returns:
the number of bits read.
Throws:
java.io.IOException

readBits

public int readBits(int bits,
                    byte[] buffer,
                    int offset,
                    int length)
             throws java.io.IOException
read the specified number of bits from the input stream (the bits will be left aligned within the buffer).

Parameters:
buffer - the data array to read it into.
bits - the number of bits to read.
offset - offset into buffer.
length - length of buffer.
Returns:
the number of bits read.
Throws:
java.io.IOException

readBits

public int readBits(int bits)
             throws java.io.IOException
Parameters:
bits - number of bits to read (<=8).
Returns:
the bits read.
Throws:
java.io.IOException


Copyright © 2006 null. All Rights Reserved.