nl.javel.gisbeans.io
Class ObjectEndianInputStream

java.lang.Object
  extended by nl.javel.gisbeans.io.ObjectEndianInputStream
All Implemented Interfaces:
DataInput, Serializable, EndianInterface

public class ObjectEndianInputStream
extends Object
implements EndianInterface, DataInput

This class enables the object inputstream to be switched from little to big endian. The class works exactly like an ObjectInputStream

Since:
JDK 1.0
Version:
1.0
Author:
Paul Jacobs Peter Jacobs
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface nl.javel.gisbeans.io.EndianInterface
BIG_ENDIAN, LITTLE_ENDIAN
 
Constructor Summary
ObjectEndianInputStream(InputStream inputStream)
          constructs a new ObjectEndianInputStream
 
Method Summary
 void close()
           
 int getEncode()
          returns the encode
 int read(byte[] b)
          reads b from the stream
 int read(byte[] b, int off, int len)
          reads b from the stream
 boolean readBoolean()
           
 byte readByte()
           
 char readChar()
           
 double readDouble()
           
 float readFloat()
          reads a float from the stream
 void readFully(byte[] b)
           
 void readFully(byte[] b, int off, int len)
           
 int readInt()
           
 String readLine()
           
 long readLong()
           
 short readShort()
           
 int readUnsignedByte()
           
 int readUnsignedShort()
           
 String readUTF()
           
static String readUTF(DataInput dataInput)
          reads UTF from the stream
 void setEncode(int encode)
          sets the Encode
 int skipBytes(int n)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectEndianInputStream

public ObjectEndianInputStream(InputStream inputStream)
constructs a new ObjectEndianInputStream

Parameters:
inputStream - the inputStream to use
Method Detail

readShort

public final short readShort()
                      throws IOException
Specified by:
readShort in interface DataInput
Throws:
IOException
See Also:
DataInput.readShort()

readUnsignedShort

public final int readUnsignedShort()
                            throws IOException
Specified by:
readUnsignedShort in interface DataInput
Throws:
IOException
See Also:
DataInput.readUnsignedShort()

readChar

public final char readChar()
                    throws IOException
Specified by:
readChar in interface DataInput
Throws:
IOException
See Also:
DataInput.readChar()

readInt

public final int readInt()
                  throws IOException
Specified by:
readInt in interface DataInput
Throws:
IOException
See Also:
DataInput.readInt()

readLong

public final long readLong()
                    throws IOException
Specified by:
readLong in interface DataInput
Throws:
IOException
See Also:
DataInput.readLong()

readFloat

public final float readFloat()
                      throws IOException
reads a float from the stream

Specified by:
readFloat in interface DataInput
Throws:
IOException
See Also:
DataInput.readFloat()

readDouble

public final double readDouble()
                        throws IOException
Specified by:
readDouble in interface DataInput
Throws:
IOException
See Also:
DataInput.readDouble()

read

public final int read(byte[] b)
               throws IOException
reads b from the stream

Parameters:
b -
Returns:
in the value
Throws:
IOException - on failure

read

public final int read(byte[] b,
                      int off,
                      int len)
               throws IOException
reads b from the stream

Parameters:
b -
off -
len -
Returns:
in the value
Throws:
IOException - on failure

readFully

public final void readFully(byte[] b)
                     throws IOException
Specified by:
readFully in interface DataInput
Throws:
IOException
See Also:
DataInput.readFully(byte[])

readFully

public final void readFully(byte[] b,
                            int off,
                            int len)
                     throws IOException
Specified by:
readFully in interface DataInput
Throws:
IOException
See Also:
DataInput.readFully(byte[], int, int)

skipBytes

public final int skipBytes(int n)
                    throws IOException
Specified by:
skipBytes in interface DataInput
Throws:
IOException
See Also:
DataInput.skipBytes(int)

readBoolean

public final boolean readBoolean()
                          throws IOException
Specified by:
readBoolean in interface DataInput
Throws:
IOException
See Also:
DataInput.readBoolean()

readByte

public final byte readByte()
                    throws IOException
Specified by:
readByte in interface DataInput
Throws:
IOException
See Also:
DataInput.readByte()

readUnsignedByte

public final int readUnsignedByte()
                           throws IOException
Specified by:
readUnsignedByte in interface DataInput
Throws:
IOException
See Also:
DataInput.readUnsignedByte()

readUTF

public final String readUTF()
                     throws IOException
Specified by:
readUTF in interface DataInput
Throws:
IOException
See Also:
DataInput.readUTF()

readLine

public final String readLine()
Specified by:
readLine in interface DataInput
See Also:
DataInput.readLine()

readUTF

public static final String readUTF(DataInput dataInput)
                            throws IOException
reads UTF from the stream

Parameters:
dataInput -
Returns:
String the value
Throws:
IOException

close

public final void close()
                 throws IOException
Throws:
IOException

setEncode

public void setEncode(int encode)
Description copied from interface: EndianInterface
sets the Encode

Specified by:
setEncode in interface EndianInterface
Parameters:
encode - the encode which is either BIG_ENDIAN or LITTLE_ENDIAN
See Also:
EndianInterface.setEncode(int)

getEncode

public int getEncode()
Description copied from interface: EndianInterface
returns the encode

Specified by:
getEncode in interface EndianInterface
Returns:
int
See Also:
EndianInterface.getEncode()