com.bbn.openmap.dataAccess.shape.input
Class LittleEndianInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FilterInputStream
          extended by java.io.DataInputStream
              extended by com.bbn.openmap.dataAccess.shape.input.LittleEndianInputStream
All Implemented Interfaces:
java.io.Closeable, java.io.DataInput

public class LittleEndianInputStream
extends java.io.DataInputStream

Provides methods for reading data streams in Little Endian and Big Endian. Adapted from the book, Java IO, Elliotte Rusty Harold, Ch. 7.

Author:
Doug Van Auken

Constructor Summary
LittleEndianInputStream(java.io.InputStream in)
          Constructor
 
Method Summary
 char readLEChar()
          Translates a little endian char into a big endian char
 double readLEDouble()
          Reads a little endian double into a big endian double
 float readLEFloat()
          Reads a little endian float into a big endian float
 int readLEInt()
          Translates a little endian int into a big endian int
 long readLELong()
          Translates a little endian long into a big endian long
 short readLEShort()
          Translates little endian short to big endian short
 int readLEUnsignedShort()
          Translates a little endian unsigned short to big endian int
 java.lang.String readLEUTF()
           
 java.lang.String readString(int length)
          Constructs a string from the underlying input stream
 
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)
Constructor

Parameters:
in - An input stream that this is chained to.
Method Detail

readString

public java.lang.String readString(int length)
                            throws java.io.IOException
Constructs a string from the underlying input stream

Parameters:
length - The length of bytes to read
Throws:
java.io.IOException

readLEShort

public short readLEShort()
                  throws java.io.IOException
Translates little endian short to big endian short

Returns:
short A big endian short
Throws:
java.io.IOException

readLEUnsignedShort

public int readLEUnsignedShort()
                        throws java.io.IOException
Translates a little endian unsigned short to big endian int

Returns:
int A big endian short
Throws:
java.io.IOException

readLEChar

public char readLEChar()
                throws java.io.IOException
Translates a little endian char into a big endian char

Returns:
char A big endian char
Throws:
java.io.IOException

readLEInt

public int readLEInt()
              throws java.io.IOException
Translates a little endian int into a big endian int

Returns:
int A big endian int
Throws:
java.io.IOException

readLELong

public long readLELong()
                throws java.io.IOException
Translates a little endian long into a big endian long

Returns:
long A big endian long
Throws:
java.io.IOException

readLEUTF

public java.lang.String readLEUTF()
                           throws java.io.IOException
Throws:
java.io.IOException

readLEDouble

public final double readLEDouble()
                          throws java.io.IOException
Reads a little endian double into a big endian double

Returns:
double A big endian double
Throws:
java.io.IOException

readLEFloat

public final float readLEFloat()
                        throws java.io.IOException
Reads a little endian float into a big endian float

Returns:
float A big endian float
Throws:
java.io.IOException


Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details