FileDocCategorySizeDatePackage
Serializer.javaAPI DocJava SE 5 API4421Fri Aug 26 14:56:02 BST 2005com.sun.org.apache.xml.internal.serializer

Serializer

public interface Serializer
The Serializer interface is implemented by Serializers to publish methods to get and set streams and writers, to set the output properties, and get the Serializer as a ContentHandler or DOMSerializer.

Fields Summary
Constructors Summary
Methods Summary
public org.xml.sax.ContentHandlerasContentHandler()
Return a {@link ContentHandler} interface into this serializer. If the serializer does not support the {@link ContentHandler} interface, it should return null.

return
A {@link ContentHandler} interface into this serializer, or null if the serializer is not SAX 2 capable
throws
IOException An I/O exception occured

public com.sun.org.apache.xml.internal.serializer.DOMSerializerasDOMSerializer()
Return a {@link DOMSerializer} interface into this serializer. If the serializer does not support the {@link DOMSerializer} interface, it should return null.

return
A {@link DOMSerializer} interface into this serializer, or null if the serializer is not DOM capable
throws
IOException An I/O exception occured

public java.util.PropertiesgetOutputFormat()
Returns the output format properties for this serializer.

return
The output format in use

public java.io.OutputStreamgetOutputStream()
Get the output stream where the events will be serialized to.

return
reference to the result stream, or null of only a writer was set.

public java.io.WritergetWriter()
Get the character stream where the events will be serialized to.

return
Reference to the result Writer, or null.

public booleanreset()
Resets the serializer. If this method returns true, the serializer may be used for subsequent serialization of new documents. It is possible to change the output format and output stream prior to serializing, or to use the existing output format and output stream.

return
True if serializer has been reset and can be reused

public voidsetOutputFormat(java.util.Properties format)
Specifies an output format for this serializer. It the serializer has already been associated with an output format, it will switch to the new format. This method should not be called while the serializer is in the process of serializing a document.

param
format The output format to use

public voidsetOutputStream(java.io.OutputStream output)
Specifies an output stream to which the document should be serialized. This method should not be called while the serializer is in the process of serializing a document.

The encoding specified in the output {@link Properties} is used, or if no encoding was specified, the default for the selected output method.

param
output The output stream

public voidsetWriter(java.io.Writer writer)
Specifies a writer to which the document should be serialized. This method should not be called while the serializer is in the process of serializing a document.

The encoding specified for the output {@link Properties} must be identical to the output format used with the writer.

param
writer The output writer stream