com.novell.java.io
Class EndianOutputStream

java.lang.Object
  |
  +--java.io.OutputStream
        |
        +--java.io.FilterOutputStream
              |
              +--java.io.DataOutputStream
                    |
                    +--com.novell.java.io.EndianOutputStream

public class EndianOutputStream
extends java.io.DataOutputStream
implements EndianOutput

Provides for writing primitive Java data types to a stream in an endian specific format.

Primitive data types are well understood types with associated operations. For example, an int is considered to be a good primitive data type. The data can be converted back using a DataInputStream. A prior knowledge of stream contents is needed.

See Also:
EndianOutput

Constructor Summary
EndianOutputStream(java.io.OutputStream out)
          Constructs a new EndianOutputStream object with an OutputStream parameter.
 
Method Summary
 void pad(int n)
          Writes empty 8-bit bytes to the specified byte boundary.
 void writeHiLoChars(java.lang.String s)
          Writes a String as a NULL-terminated sequence of chars in high-low order.
 void writeHiLoInt(int v)
          Writes a 32-bit int in high-low order.
 void writeHiLoLong(long v)
          Writes a 64-bit long in high-low order.
 void writeHiLoShort(int v)
          Writes a 16-bit short in high-low order.
 void writeLoHiChars(java.lang.String s)
          Writes a String as a NULL-terminated sequence of chars in low-high order.
 void writeLoHiInt(int v)
          Writes a 32-bit int in low-high order.
 void writeLoHiLong(long v)
          Writes a 64-bit long in low-high order.
 void writeLoHiShort(int v)
          Writes a 16-bit short in low-high order.
 
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
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EndianOutputStream

public EndianOutputStream(java.io.OutputStream out)
Constructs a new EndianOutputStream object with an OutputStream parameter.
Parameters:
out - The Output stream.
Method Detail

writeHiLoChars

public final void writeHiLoChars(java.lang.String s)
                          throws java.io.IOException
Writes a String as a NULL-terminated sequence of chars in high-low order.
Specified by:
writeHiLoChars in interface EndianOutput
Parameters:
s - The String of chars to be written.
Throws:
java.io.IOException - If an I/O error has occurred.

writeLoHiChars

public final void writeLoHiChars(java.lang.String s)
                          throws java.io.IOException
Writes a String as a NULL-terminated sequence of chars in low-high order.
Specified by:
writeLoHiChars in interface EndianOutput
Parameters:
s - The String of chars to be written.
Throws:
java.io.IOException - If an I/O error has occurred.

writeHiLoInt

public final void writeHiLoInt(int v)
                        throws java.io.IOException
Writes a 32-bit int in high-low order.
Specified by:
writeHiLoInt in interface EndianOutput
Parameters:
v - The integer value to be written.
Throws:
java.io.IOException - If an I/O error has occurred.

writeLoHiInt

public final void writeLoHiInt(int v)
                        throws java.io.IOException
Writes a 32-bit int in low-high order.
Specified by:
writeLoHiInt in interface EndianOutput
Parameters:
v - The integer value to be written.
Throws:
java.io.IOException - If an I/O error has occurred.

writeHiLoShort

public final void writeHiLoShort(int v)
                          throws java.io.IOException
Writes a 16-bit short in high-low order.
Specified by:
writeHiLoShort in interface EndianOutput
Parameters:
v - The short value to be written.
Throws:
java.io.IOException - If an I/O error has occurred.

writeLoHiShort

public final void writeLoHiShort(int v)
                          throws java.io.IOException
Writes a 16-bit short in low-high order.
Specified by:
writeLoHiShort in interface EndianOutput
Parameters:
v - The short value to be written.
Throws:
java.io.IOException - If an I/O error has occurred.

writeHiLoLong

public final void writeHiLoLong(long v)
                         throws java.io.IOException
Writes a 64-bit long in high-low order.
Specified by:
writeHiLoLong in interface EndianOutput
Parameters:
v - The long value to be written.
Throws:
java.io.IOException - If an I/O error has occurred.

writeLoHiLong

public final void writeLoHiLong(long v)
                         throws java.io.IOException
Writes a 64-bit long in low-high order.
Specified by:
writeLoHiLong in interface EndianOutput
Parameters:
v - The long value to be written.
Throws:
java.io.IOException - If an I/O error has occurred.

pad

public final void pad(int n)
               throws java.io.IOException
Writes empty 8-bit bytes to the specified byte boundary.
Parameters:
n - The byte boundary.
Throws:
java.io.IOException - If an I/O error has occurred.