org.walluck.io
Class LittleEndianOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.FilterOutputStream
          extended by java.io.DataOutputStream
              extended by org.walluck.io.DataOutputStreamEx
                  extended by org.walluck.io.LittleEndianOutputStream
All Implemented Interfaces:
Closeable, DataOutput, Flushable
Direct Known Subclasses:
AIMOutputStream

public class LittleEndianOutputStream
extends DataOutputStreamEx

An output stream that supports little endian byte order to the limited degree nedded to support ICQ.

Since:
1.0
Version:
1.0
Author:
David Walluck
See Also:
DataOutputStreamEx

Field Summary
 
Fields inherited from class java.io.DataOutputStream
written
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
LittleEndianOutputStream(OutputStream os)
          Creates a new little endian output stream.
 
Method Summary
 void writeIntLE(int n)
          Write an integer to this stream in little endian byte order.
 void writeShortLE(int n)
          Write a short to this stream in little endian byte order.
 void writeStringLLLE0(String s)
          Write a string to this stream prefixed by its length, a short in little endian byte order, terminated by a null.
 
Methods inherited from class org.walluck.io.DataOutputStreamEx
writeBytes, writeString, writeString0, writeStringL, writeStringLL, writeStringLL0, writeStringNullPadded
 
Methods inherited from class java.io.DataOutputStream
flush, size, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF
 
Methods inherited from class java.io.FilterOutputStream
close, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.io.DataOutput
write
 

Constructor Detail

LittleEndianOutputStream

public LittleEndianOutputStream(OutputStream os)
Creates a new little endian output stream.

Parameters:
os - the underlying output stream
Method Detail

writeIntLE

public void writeIntLE(int n)
                throws IOException
Write an integer to this stream in little endian byte order.

Parameters:
n - the integer to write
Throws:
IOException - if an error occurs

writeShortLE

public void writeShortLE(int n)
                  throws IOException
Write a short to this stream in little endian byte order.

Parameters:
n - the short to write
Throws:
IOException - if an error occurs

writeStringLLLE0

public void writeStringLLLE0(String s)
                      throws IOException
Write a string to this stream prefixed by its length, a short in little endian byte order, terminated by a null.

Parameters:
s - the string to write
Throws:
IOException - if an error occurs