Class DefaultConfigurationSerializer
- java.lang.Object
-
- org.apache.avalon.framework.configuration.DefaultConfigurationSerializer
-
public class DefaultConfigurationSerializer extends java.lang.ObjectA ConfigurationSerializer serializes configurations via SAX2 compliant parser.- Version:
- CVS $Revision: 1.26 $ $Date: 2004/02/11 14:34:25 $
- Author:
- Avalon Development Team
-
-
Constructor Summary
Constructors Constructor Description DefaultConfigurationSerializer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.xml.sax.ContentHandlercreateContentHandler(javax.xml.transform.Result result)Create a ContentHandler for an OutputStreamprotected javax.xml.transform.sax.SAXTransformerFactorygetTransformerFactory()Get the SAXTransformerFactory so we can get a serializer without being tied to one vendor.voidserialize(java.io.OutputStream outputStream, Configuration source)Serialize the configuration object to an output stream.voidserialize(java.lang.String uri, Configuration source)Serialize the configuration object to an output stream derived from an URI.java.lang.Stringserialize(Configuration source)Serialize the configuration object to a stringvoidserialize(org.xml.sax.ContentHandler handler, Configuration source)Serialize the configuration to a ContentHandlerprotected voidserializeElement(org.xml.sax.ContentHandler handler, org.xml.sax.helpers.NamespaceSupport namespaceSupport, Configuration element)Serialize each Configuration element.voidserializeToFile(java.io.File file, Configuration source)Serialize the configuration object to a file using a File object.voidserializeToFile(java.lang.String filename, Configuration source)Serialize the configuration object to a file using a filename.voidsetIndent(boolean indent)Sets the Serializer's use of indentation.
-
-
-
Method Detail
-
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.- Parameters:
indent- abooleanvalue
-
createContentHandler
protected org.xml.sax.ContentHandler createContentHandler(javax.xml.transform.Result result)
Create a ContentHandler for an OutputStream- Parameters:
result- the result- Returns:
- contenthandler that goes to specified OutputStream
-
getTransformerFactory
protected javax.xml.transform.sax.SAXTransformerFactory getTransformerFactory()
Get the SAXTransformerFactory so we can get a serializer without being tied to one vendor.- Returns:
- a
SAXTransformerFactoryvalue
-
serialize
public void serialize(org.xml.sax.ContentHandler handler, Configuration source) throws org.xml.sax.SAXException, ConfigurationExceptionSerialize the configuration to a ContentHandler- Parameters:
handler- aContentHandlerto serialize tosource- aConfigurationvalue- Throws:
org.xml.sax.SAXException- if an error occursConfigurationException- if an error occurs
-
serializeElement
protected void serializeElement(org.xml.sax.ContentHandler handler, org.xml.sax.helpers.NamespaceSupport namespaceSupport, Configuration element) throws org.xml.sax.SAXException, ConfigurationExceptionSerialize each Configuration element. This method is called recursively.- Parameters:
handler- aContentHandlerto usenamespaceSupport- aNamespaceSupportto useelement- aConfigurationvalue- Throws:
org.xml.sax.SAXException- if an error occursConfigurationException- if an error occurs
-
serializeToFile
public void serializeToFile(java.lang.String filename, Configuration source) throws org.xml.sax.SAXException, java.io.IOException, ConfigurationExceptionSerialize the configuration object to a file using a filename.- Parameters:
filename- aStringvaluesource- aConfigurationvalue- Throws:
org.xml.sax.SAXException- if an error occursjava.io.IOException- if an error occursConfigurationException- if an error occurs
-
serializeToFile
public void serializeToFile(java.io.File file, Configuration source) throws org.xml.sax.SAXException, java.io.IOException, ConfigurationExceptionSerialize the configuration object to a file using a File object.- Parameters:
file- aFilevaluesource- aConfigurationvalue- Throws:
org.xml.sax.SAXException- if an error occursjava.io.IOException- if an error occursConfigurationException- if an error occurs
-
serialize
public void serialize(java.io.OutputStream outputStream, Configuration source) throws org.xml.sax.SAXException, java.io.IOException, ConfigurationExceptionSerialize the configuration object to an output stream.- Parameters:
outputStream- anOutputStreamvaluesource- aConfigurationvalue- Throws:
org.xml.sax.SAXException- if an error occursjava.io.IOException- if an error occursConfigurationException- if an error occurs
-
serialize
public void serialize(java.lang.String uri, Configuration source) throws org.xml.sax.SAXException, java.io.IOException, ConfigurationExceptionSerialize the configuration object to an output stream derived from an URI. The URI must be resolveable by thejava.net.URLobject.- Parameters:
uri- aStringvaluesource- aConfigurationvalue- Throws:
org.xml.sax.SAXException- if an error occursjava.io.IOException- if an error occursConfigurationException- if an error occurs
-
serialize
public java.lang.String serialize(Configuration source) throws org.xml.sax.SAXException, ConfigurationException
Serialize the configuration object to a string- Parameters:
source- aConfigurationvalue- Returns:
- configuration serialized as a string.
- Throws:
org.xml.sax.SAXException- if an error occursConfigurationException- if an error occurs
-
-