org.apache.avalon.framework.configuration
Class DefaultConfigurationSerializer
java.lang.Object
org.apache.avalon.framework.configuration.DefaultConfigurationSerializer
public class DefaultConfigurationSerializer
extends java.lang.Object
A ConfigurationSerializer serializes configurations via SAX2 compliant parser.
Version:
- Avalon Development Team
protected ContentHandler | createContentHandler(Result result) - Create a ContentHandler for an OutputStream
|
protected SAXTransformerFactory | getTransformerFactory() - Get the SAXTransformerFactory so we can get a serializer without being
tied to one vendor.
|
void | serialize(ContentHandler handler, Configuration source) - Serialize the configuration to a ContentHandler
|
void | serialize(OutputStream outputStream, Configuration source) - Serialize the configuration object to an output stream.
|
void | serialize(String uri, Configuration source) - Serialize the configuration object to an output stream derived from an
URI.
|
String | serialize(Configuration source) - Serialize the configuration object to a string
|
protected void | serializeElement(ContentHandler handler, NamespaceSupport namespaceSupport, Configuration element) - Serialize each Configuration element.
|
void | serializeToFile(File file, Configuration source) - Serialize the configuration object to a file using a File object.
|
void | serializeToFile(String filename, Configuration source) - Serialize the configuration object to a file using a filename.
|
void | setIndent(boolean indent) - Sets the Serializer's use of indentation.
|
createContentHandler
protected ContentHandler createContentHandler(Result result)
Create a ContentHandler for an OutputStream
result
- the result
- contenthandler that goes to specified OutputStream
getTransformerFactory
protected SAXTransformerFactory getTransformerFactory()
Get the SAXTransformerFactory so we can get a serializer without being
tied to one vendor.
- a
SAXTransformerFactory
value
serialize
public void serialize(OutputStream outputStream,
Configuration source)
throws SAXException,
IOException,
ConfigurationException
Serialize the configuration object to an output stream.
outputStream
- an OutputStream
valuesource
- a Configuration
value
ConfigurationException
- if an error occurs
serialize
public void serialize(String uri,
Configuration source)
throws SAXException,
IOException,
ConfigurationException
Serialize the configuration object to an output stream derived from an
URI. The URI must be resolveable by the java.net.URL
object.
uri
- a String
valuesource
- a Configuration
value
ConfigurationException
- if an error occurs
serializeElement
protected void serializeElement(ContentHandler handler,
NamespaceSupport namespaceSupport,
Configuration element)
throws SAXException,
ConfigurationException
Serialize each Configuration element. This method is called recursively.
handler
- a ContentHandler
to usenamespaceSupport
- a NamespaceSupport
to useelement
- a Configuration
value
ConfigurationException
- if an error occurs
serializeToFile
public void serializeToFile(File file,
Configuration source)
throws SAXException,
IOException,
ConfigurationException
Serialize the configuration object to a file using a File object.
file
- a File
valuesource
- a Configuration
value
ConfigurationException
- if an error occurs
serializeToFile
public void serializeToFile(String filename,
Configuration source)
throws SAXException,
IOException,
ConfigurationException
Serialize the configuration object to a file using a filename.
filename
- a String
valuesource
- a Configuration
value
ConfigurationException
- if an error occurs
setIndent
public void setIndent(boolean indent)
Sets the Serializer's use of indentation. This will cause linefeeds to be added
after each element, but it does not add any indentation via spaces.
indent
- a boolean
value
"Copyright B) 2001 Apache Jakarta Project. All Rights Reserved."