nl.javel.gisbeans.io
Class ObjectEndianOutputStream

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

public class ObjectEndianOutputStream
extends Object
implements EndianInterface, DataOutput

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

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

Field Summary
 
Fields inherited from interface nl.javel.gisbeans.io.EndianInterface
BIG_ENDIAN, LITTLE_ENDIAN
 
Constructor Summary
ObjectEndianOutputStream(OutputStream outputStream)
          constructs a new ObjectEndianOutputStream.
 
Method Summary
 void close()
          closes the stream
 void flush()
          flushes the stream
 int getEncode()
          returns the encode
 void setEncode(int encode)
          sets the Encode
 int size()
           
 void write(byte[] buffer)
           
 void write(byte[] buffer, int off, int len)
           
 void write(int value)
           
 void writeBoolean(boolean value)
           
 void writeByte(int value)
           
 void writeBytes(String string)
           
 void writeChar(int value)
           
 void writeChars(String string)
           
 void writeDouble(double value)
           
 void writeFloat(float value)
           
 void writeInt(int value)
           
 void writeLong(long value)
           
 void writeShort(int value)
           
 void writeUTF(String string)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectEndianOutputStream

public ObjectEndianOutputStream(OutputStream outputStream)
constructs a new ObjectEndianOutputStream.

Parameters:
outputStream - the target.
Method Detail

write

public void write(byte[] buffer,
                  int off,
                  int len)
           throws IOException
Specified by:
write in interface DataOutput
Throws:
IOException
See Also:
DataOutput.write(byte[], int, int)

writeFloat

public void writeFloat(float value)
                throws IOException
Specified by:
writeFloat in interface DataOutput
Throws:
IOException
See Also:
DataOutput.writeFloat(float)

write

public void write(int value)
           throws IOException
Specified by:
write in interface DataOutput
Throws:
IOException
See Also:
DataOutput.write(int)

writeShort

public void writeShort(int value)
                throws IOException
Specified by:
writeShort in interface DataOutput
Throws:
IOException
See Also:
DataOutput.writeShort(int)

writeBytes

public void writeBytes(String string)
                throws IOException
Specified by:
writeBytes in interface DataOutput
Throws:
IOException
See Also:
DataOutput.writeBytes(java.lang.String)

writeChar

public void writeChar(int value)
               throws IOException
Specified by:
writeChar in interface DataOutput
Throws:
IOException
See Also:
DataOutput.writeChar(int)

writeByte

public void writeByte(int value)
               throws IOException
Specified by:
writeByte in interface DataOutput
Throws:
IOException
See Also:
DataOutput.writeByte(int)

writeBoolean

public void writeBoolean(boolean value)
                  throws IOException
Specified by:
writeBoolean in interface DataOutput
Throws:
IOException
See Also:
DataOutput.writeBoolean(boolean)

writeLong

public void writeLong(long value)
               throws IOException
Specified by:
writeLong in interface DataOutput
Throws:
IOException
See Also:
DataOutput.writeLong(long)

writeUTF

public void writeUTF(String string)
              throws IOException
Specified by:
writeUTF in interface DataOutput
Throws:
IOException
See Also:
DataOutput.writeUTF(java.lang.String)

writeInt

public void writeInt(int value)
              throws IOException
Specified by:
writeInt in interface DataOutput
Throws:
IOException
See Also:
DataOutput.writeInt(int)

writeChars

public void writeChars(String string)
                throws IOException
Specified by:
writeChars in interface DataOutput
Throws:
IOException
See Also:
DataOutput.writeChars(java.lang.String)

write

public void write(byte[] buffer)
           throws IOException
Specified by:
write in interface DataOutput
Throws:
IOException
See Also:
DataOutput.write(byte[])

writeDouble

public void writeDouble(double value)
                 throws IOException
Specified by:
writeDouble in interface DataOutput
Throws:
IOException
See Also:
DataOutput.writeDouble(double)

size

public final int size()
Returns:
the size of the stream

flush

public void flush()
           throws IOException
flushes the stream

Throws:
IOException

close

public void close()
           throws IOException
closes the stream

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()