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
serialize themselves as XML.
- Version:
- 1.01
- Author:
- Ronald Bourret, Technical University of Darmstadt
-
attrs
- Array for storing attribute names.
-
values
- Array for storing attribute values.
-
XMLOutputStream()
- Construct a new XMLOutputStream.
-
XMLOutputStream(OutputStream)
- Construct a new XMLOutputStream and set the OutputStream.
-
allocateAttrs(int)
- Allocate the attrs and values arrays.
-
initAttrs()
-
-
setOutputStream(OutputStream)
- Set the OutputStream.
-
setPrettyPrinting(boolean, int)
- Set the pretty printing options.
-
writeCharacters(byte[])
- Write PCDATA.
-
writeCharacters(byte[], int, int)
- Write PCDATA starting at a given position
-
writeDOCTYPE(byte[], byte[], byte[])
- Write the DOCTYPE statement.
-
writeElementEnd(byte[])
- Write an element end tag.
-
writeElementStart(byte[], byte[][], byte[][], boolean)
- Write an element start tag.
-
writeXMLDecl(byte[])
- Write the XML declaration.
-
writeXMLDecl(byte[], boolean)
- Write the XML declaration with a standalone declaration.
attrs
public byte attrs[][]
- Array for storing attribute names.
values
public byte values[][]
- Array for storing attribute values.
XMLOutputStream
public XMLOutputStream()
- Construct a new XMLOutputStream.
XMLOutputStream
public XMLOutputStream(OutputStream out)
- Construct a new XMLOutputStream and set the OutputStream.
setOutputStream
public void setOutputStream(OutputStream out)
- Set the OutputStream.
- Parameters:
- out - The output stream.
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.
writeXMLDecl
public void writeXMLDecl(byte encoding[]) throws IOException
- Write the XML declaration.
- Parameters:
- encoding - The encoding to use. May be null.
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.
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.
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.
writeElementEnd
public void writeElementEnd(byte name[]) throws IOException
- Write an element end tag.
- Parameters:
- name - The name of the element type.
writeCharacters
public void writeCharacters(byte characters[]) throws IOException
- Write PCDATA.
- Parameters:
- characters - The PCDATA.
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.
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.
initAttrs
public void initAttrs()
All Packages Class Hierarchy This Package Previous Next Index