amber.type
Class AmberOutputStream

java.lang.Object
  |
  +--java.io.OutputStream
        |
        +--java.io.FilterOutputStream
              |
              +--java.io.DataOutputStream
                    |
                    +--amber.type.AmberOutputStream
All Implemented Interfaces:
java.io.DataOutput

public class AmberOutputStream
extends java.io.DataOutputStream

An extension to the standard DataOutputStream. This object allows the streaming of strings > 32k characters. It also handles null strings.

Version:
1.0.0
Author:
Dr. David J. Knowles
See Also:
DataOutputStream

Fields inherited from class java.io.DataOutputStream
written
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
AmberOutputStream(java.io.OutputStream out)
          Creates a new extended data output stream which writes data to the underlying output stream.
 
Method Summary
 void writeLongUTF(java.lang.String str)
          Writes a string to the underlying output stream using UTF-8 encoding in a machine-independent manner.
 
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

AmberOutputStream

public AmberOutputStream(java.io.OutputStream out)
Creates a new extended data output stream which writes data to the underlying output stream.
Parameters:
out - OutputStream to write the data to.
Method Detail

writeLongUTF

public final void writeLongUTF(java.lang.String str)
                        throws java.io.IOException
Writes a string to the underlying output stream using UTF-8 encoding in a machine-independent manner. This function is a modified version of the writeUTF function which has a 65536 byte limit.

This function differs in two ways:
First, the length is encoded using 4 bytes rather than 2. This allows long strings to be encoded.
Second, the encoding of the string is preceeded by a type byte. This allows the stream to encode null strings in a meaningful way.

Parameters:
str - The string to be written out.
Throws:
java.io.IOException - with any encoding errors.


Copyright © 2002 Clearfield Research Ltd. All Rights Reserved.