org.walluck.io
Class DataOutputStreamEx

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

public class DataOutputStreamEx
extends DataOutputStream

A data output stream with a few more methods.

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

Field Summary
 
Fields inherited from class java.io.DataOutputStream
written
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
DataOutputStreamEx(OutputStream os)
          Creates a new data output stream ex from the underlying output stream.
 
Method Summary
 void writeBytes(byte[] b)
          Writes a byte array (not a string) to this stream.
 void writeString(String s)
          A more correct name for writeBytes.
 void writeString0(String s)
          Write a string to this stream and null terminate it.
 void writeStringL(String s)
          Write a byte prefixed string to this stream.
 void writeStringLL(String s)
          Write a short prefixed string to this stream.
 void writeStringLL0(String s)
          Write a short prefixed null-terminated string to this stream.
 void writeStringNullPadded(String s, int length)
          Write a null padded string to this stream.
 
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

DataOutputStreamEx

public DataOutputStreamEx(OutputStream os)
Creates a new data output stream ex from the underlying output stream.

Parameters:
os - the underlying output stream
Method Detail

writeString

public void writeString(String s)
                 throws IOException
A more correct name for writeBytes.

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

writeBytes

public void writeBytes(byte[] b)
                throws IOException
Writes a byte array (not a string) to this stream.

Parameters:
b - the byte array
Throws:
IOException - if an error occurs

writeString0

public void writeString0(String s)
                  throws IOException
Write a string to this stream and null terminate it.

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

writeStringL

public void writeStringL(String s)
                  throws IOException
Write a byte prefixed string to this stream.

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

writeStringLL

public void writeStringLL(String s)
                   throws IOException
Write a short prefixed string to this stream.

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

writeStringLL0

public void writeStringLL0(String s)
                    throws IOException
Write a short prefixed null-terminated string to this stream.

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

writeStringNullPadded

public void writeStringNullPadded(String s,
                                  int length)
                           throws IOException
Write a null padded string to this stream.

Parameters:
s - the string
length - the total length the padded string should be
Throws:
IOException - if an error occurs