All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class de.tudarmstadt.ito.utils.XMLOutputStream

java.lang.Object
   |
   +----de.tudarmstadt.ito.utils.XMLOutputStream

public class XMLOutputStream
extends Object
Utility methods for writing an XML document to an OutputStream.

This is used as the base class for classes such as Map, which need to serialized themselves as XML.


Variable Index

 o attrs
Array for storing attribute names.
 o values
Array for storing attribute values.

Constructor Index

 o XMLOutputStream()
Construct a new XMLOutputStream.
 o XMLOutputStream(OutputStream)
Construct a new XMLOutputStream and set the OutputStream.

Method Index

 o allocateAttrs(int)
Allocate the attrs and values arrays.
 o initAttrs()
 o setOutputStream(OutputStream)
Set the OutputStream.
 o setPrettyPrinting(boolean, int)
Set the pretty printing options.
 o writeCharacters(byte[])
Write PCDATA.
 o writeCharacters(byte[], int, int)
Write PCDATA starting at a given position
 o writeDOCTYPE(byte[], byte[], byte[])
Write the DOCTYPE statement.
 o writeElementEnd(byte[])
Write an element end tag.
 o writeElementStart(byte[], byte[][], byte[][], boolean)
Write an element start tag.
 o writeXMLDecl(byte[])
Write the XML declaration.
 o writeXMLDecl(byte[], boolean)
Write the XML declaration with a standalone declaration.

Variables

 o attrs
 public byte attrs[][]
Array for storing attribute names.

 o values
 public byte values[][]
Array for storing attribute values.

Constructors

 o XMLOutputStream
 public XMLOutputStream()
Construct a new XMLOutputStream.

 o XMLOutputStream
 public XMLOutputStream(OutputStream out)
Construct a new XMLOutputStream and set the OutputStream.

Methods

 o setOutputStream
 public void setOutputStream(OutputStream out)
Set the OutputStream.

Parameters:
out - The output stream.
 o setPrettyPrinting
 public void setPrettyPrinting(boolean pretty,
                               int increment)
Set the pretty printing options.

Parameters:
pretty - Whether to perform pretty printing.
increment - The number of spaces by which to indent nested child elements in their parent. If this is less then 0, it is set to 3.
 o writeXMLDecl
 public void writeXMLDecl(byte encoding[]) throws IOException
Write the XML declaration.

Parameters:
encoding - The encoding to use. May be null.
 o writeXMLDecl
 public void writeXMLDecl(byte encoding[],
                          boolean standalone) throws IOException
Write the XML declaration with a standalone declaration.

Parameters:
encoding - The encoding to use. May be null.
standalone - Whether the standalone declaration is yes or no.
 o writeDOCTYPE
 public void writeDOCTYPE(byte root[],
                          byte systemID[],
                          byte publicID[]) throws IOException
Write the DOCTYPE statement. Internal subsets are not supported.

Parameters:
root - The root element type.
systemID - The system ID of the external subset.
publicID - The public ID of the external subset. May be null.
 o writeElementStart
 public void writeElementStart(byte name[],
                               byte attrs[][],
                               byte values[][],
                               boolean empty) throws IOException
Write an element start tag.

Parameters:
name - The name of the element type.
attrs - The attribute names. May be null.
values - The attribute values. Must match attrs in number and order. May be null.
empty - Whether the element is empty.
 o writeElementEnd
 public void writeElementEnd(byte name[]) throws IOException
Write an element end tag.

Parameters:
name - The name of the element type.
 o writeCharacters
 public void writeCharacters(byte characters[]) throws IOException
Write PCDATA.

Parameters:
characters - The PCDATA.
 o writeCharacters
 public void writeCharacters(byte characters[],
                             int start,
                             int length) throws IOException
Write PCDATA starting at a given position

Parameters:
characters - The PCDATA.
start - The start position.
length - The number of characters to write.
 o allocateAttrs
 public void allocateAttrs(int size)
Allocate the attrs and values arrays. Generally, subclasses allocate arrays large enough to handle the maximum number of attributes found on any element type. Before each call to writeElementStart, they then call initAttrs, which initializes the attributes to nulls; writeElementStart stops writing attributes the first time it encounters a value of the attrs variable that is null.

Parameters:
size - The array size.
 o initAttrs
 public void initAttrs()

All Packages  Class Hierarchy  This Package  Previous  Next  Index