com.dynalivery.dor
Class StringToXMLHelper

java.lang.Object
  |
  +--com.dynalivery.dor.StringToXMLHelper

public class StringToXMLHelper
extends java.lang.Object

This helper class is designed to allow many short strings to be streamed to an output stream with UTF8 encoding while bounding the memory use and reducing object creation to help performance. It accomplishes this by appending String's to a StringBuffer which is only allowed to grow to a maximum size before the conversion to UTF8 occurs and the byte array written to the OutputStream. The StringBuffer is used because a call to convert a String to a byte array results in object creation every time.


Constructor Summary
StringToXMLHelper(java.io.OutputStream outStream, int maxBufferSize)
          Creates new StringToXMLHelper
 
Method Summary
 StringToXMLHelper append(byte value)
           
 StringToXMLHelper append(double value)
           
 StringToXMLHelper append(int value)
           
 StringToXMLHelper append(short value)
           
 StringToXMLHelper append(java.lang.String string)
           
 void close()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringToXMLHelper

public StringToXMLHelper(java.io.OutputStream outStream,
                         int maxBufferSize)
Creates new StringToXMLHelper
Method Detail

append

public StringToXMLHelper append(java.lang.String string)
                         throws java.io.IOException

append

public StringToXMLHelper append(double value)
                         throws java.io.IOException

append

public StringToXMLHelper append(int value)
                         throws java.io.IOException

append

public StringToXMLHelper append(byte value)
                         throws java.io.IOException

append

public StringToXMLHelper append(short value)
                         throws java.io.IOException

close

public void close()
           throws java.io.IOException