com.wutka.jox
Class JOXBeanOutputStream

java.lang.Object
  |
  +--java.io.OutputStream
        |
        +--java.io.FilterOutputStream
              |
              +--com.wutka.jox.JOXBeanOutputStream

public class JOXBeanOutputStream
extends java.io.FilterOutputStream
implements com.wutka.jox.JOXOutput

An output stream filter that writes out a bean as an XML document. The stream can write out basic Java types, their object equivalents and also strings, dates and other beans. The XML tag names are the same as the bean properties.


Field Summary
static java.lang.String DEFAULT_ENCODING
           
protected  java.lang.String encoding
           
protected  com.wutka.jox.JOXBeanOutput output
           
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
JOXBeanOutputStream(com.wutka.dtd.DTD dtd, java.io.OutputStream baseOutputStream)
          Create a new output stream around an existing stream and specifies a DTD for selecting which attributes should be written and what the names should look like.
JOXBeanOutputStream(com.wutka.dtd.DTD dtd, java.io.OutputStream baseOutputStream, java.lang.String anEncoding)
          Create a new output stream around an existing stream and specifies a DTD for selecting which attributes should be written and what the names should look like.
JOXBeanOutputStream(java.io.OutputStream baseOutputStream)
          Create a new output stream around an existing stream
JOXBeanOutputStream(java.io.OutputStream baseOutputStream, boolean writeAttributes)
          Create a new output stream around an existing stream
JOXBeanOutputStream(java.io.OutputStream baseOutputStream, boolean writeAttributes, java.lang.String anEncoding)
          Create a new output stream around an existing stream
JOXBeanOutputStream(java.io.OutputStream baseOutputStream, java.lang.String anEncoding)
          Create a new output stream around an existing stream
JOXBeanOutputStream(java.lang.String dtdURI, java.io.OutputStream baseOutputStream)
          Create a new output stream around an existing stream and specifies a DTD for selecting which attributes should be written and what the names should look like.
JOXBeanOutputStream(java.lang.String dtdURI, java.io.OutputStream baseOutputStream, java.lang.String anEncoding)
          Create a new output stream around an existing stream and specifies a DTD for selecting which attributes should be written and what the names should look like.
 
Method Summary
 void writeObject(java.lang.String rootName, java.lang.Object ob)
          Writes a bean as XML, using rootName as the tag name for the document root.
 void writeString(java.lang.String str)
          Write a string to the output stream.
 
Methods inherited from class java.io.FilterOutputStream
close, flush, write, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_ENCODING

public static final java.lang.String DEFAULT_ENCODING

output

protected com.wutka.jox.JOXBeanOutput output

encoding

protected java.lang.String encoding
Constructor Detail

JOXBeanOutputStream

public JOXBeanOutputStream(java.io.OutputStream baseOutputStream)
Create a new output stream around an existing stream
Parameters:
baseOutputStream - The underlying output stream

JOXBeanOutputStream

public JOXBeanOutputStream(java.io.OutputStream baseOutputStream,
                           java.lang.String anEncoding)
Create a new output stream around an existing stream
Parameters:
baseOutputStream - The underlying output stream
encoding - The XML encoding for the output

JOXBeanOutputStream

public JOXBeanOutputStream(java.io.OutputStream baseOutputStream,
                           boolean writeAttributes)
Create a new output stream around an existing stream
Parameters:
baseOutputStream - The underlying output stream
writeAttributes - Indicates whether we should write simple properties as attributes

JOXBeanOutputStream

public JOXBeanOutputStream(java.io.OutputStream baseOutputStream,
                           boolean writeAttributes,
                           java.lang.String anEncoding)
Create a new output stream around an existing stream
Parameters:
baseOutputStream - The underlying output stream
writeAttributes - Indicates whether we should write simple properties as attributes
encoding - The XML encoding for the output

JOXBeanOutputStream

public JOXBeanOutputStream(java.lang.String dtdURI,
                           java.io.OutputStream baseOutputStream)
                    throws java.io.IOException
Create a new output stream around an existing stream and specifies a DTD for selecting which attributes should be written and what the names should look like.
Parameters:
dtdURI - The URI of the DTD
baseOutputStream - The underlying output stream

JOXBeanOutputStream

public JOXBeanOutputStream(java.lang.String dtdURI,
                           java.io.OutputStream baseOutputStream,
                           java.lang.String anEncoding)
                    throws java.io.IOException
Create a new output stream around an existing stream and specifies a DTD for selecting which attributes should be written and what the names should look like.
Parameters:
dtdURI - The URI of the DTD
baseOutputStream - The underlying output stream
encoding - The XML encoding for the output

JOXBeanOutputStream

public JOXBeanOutputStream(com.wutka.dtd.DTD dtd,
                           java.io.OutputStream baseOutputStream)
                    throws java.io.IOException
Create a new output stream around an existing stream and specifies a DTD for selecting which attributes should be written and what the names should look like.
Parameters:
dtd - The DTD to use
baseOutputStream - The underlying output stream

JOXBeanOutputStream

public JOXBeanOutputStream(com.wutka.dtd.DTD dtd,
                           java.io.OutputStream baseOutputStream,
                           java.lang.String anEncoding)
                    throws java.io.IOException
Create a new output stream around an existing stream and specifies a DTD for selecting which attributes should be written and what the names should look like.
Parameters:
dtd - The DTD to use
baseOutputStream - The underlying output stream
Method Detail

writeObject

public void writeObject(java.lang.String rootName,
                        java.lang.Object ob)
                 throws java.io.IOException
Writes a bean as XML, using rootName as the tag name for the document root. Other tag names will come from the names of the bean attributes.
Parameters:
rootName - The name of the document root
ob - The object to write out
Throws:
java.io.IOException - If there is an error writing the object

writeString

public void writeString(java.lang.String str)
                 throws java.io.IOException
Write a string to the output stream. This method is used by the output utility to write a string to either an output stream or a writer.
Specified by:
writeString in interface com.wutka.jox.JOXOutput
Parameters:
str - The string to write