net.sf.image4j.io
Class LittleEndianInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FilterInputStream
          extended by java.io.DataInputStream
              extended by net.sf.image4j.io.LittleEndianInputStream
All Implemented Interfaces:
java.io.Closeable, java.io.DataInput

public class LittleEndianInputStream
extends java.io.DataInputStream

Reads little-endian data from a source InputStream by reversing byte ordering.

Author:
Ian McDonagh

Field Summary
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
LittleEndianInputStream(java.io.InputStream in)
          Creates a new instance of LittleEndianInputStream, which will read from the specified source.
 
Method Summary
 double readDoubleLE()
          Reads a little-endian double value.
 float readFloatLE()
          Reads a little-endian float value.
 int readIntLE()
          Reads a little-endian int value.
 long readLongLE()
          Reads a little-endian long value.
 short readShortLE()
          Reads a little-endian short value
 long readUnsignedInt()
           
 long readUnsignedIntLE()
           
 
Methods inherited from class java.io.DataInputStream
read, read, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, 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
 

Constructor Detail

LittleEndianInputStream

public LittleEndianInputStream(java.io.InputStream in)
Creates a new instance of LittleEndianInputStream, which will read from the specified source.

Parameters:
in - the source InputStream
Method Detail

readShortLE

public short readShortLE()
                  throws java.io.IOException
Reads a little-endian short value

Returns:
short value with reversed byte order
Throws:
java.io.IOException - if an error occurs

readIntLE

public int readIntLE()
              throws java.io.IOException
Reads a little-endian int value.

Returns:
int value with reversed byte order
Throws:
java.io.IOException - if an error occurs

readFloatLE

public float readFloatLE()
                  throws java.io.IOException
Reads a little-endian float value.

Returns:
float value with reversed byte order
Throws:
java.io.IOException - if an error occurs

readLongLE

public long readLongLE()
                throws java.io.IOException
Reads a little-endian long value.

Returns:
long value with reversed byte order
Throws:
java.io.IOException - if an error occurs

readDoubleLE

public double readDoubleLE()
                    throws java.io.IOException
Reads a little-endian double value.

Returns:
double value with reversed byte order
Throws:
java.io.IOException - if an error occurs

readUnsignedInt

public long readUnsignedInt()
                     throws java.io.IOException
Throws:
java.io.IOException
Since:
0.6

readUnsignedIntLE

public long readUnsignedIntLE()
                       throws java.io.IOException
Throws:
java.io.IOException
Since:
0.6