org.apache.jsieve.util
Class OutputUtils

java.lang.Object
  extended by org.apache.jsieve.util.OutputUtils

public class OutputUtils
extends java.lang.Object

Output utilities. These are mostly convenience methods. More power and flexibility is available when using the objects directly.


Constructor Summary
OutputUtils()
           
 
Method Summary
static void toSieve(org.apache.jsieve.parser.generated.Node node, java.io.Writer writer)
          Writes the tree rooted at the given node to a Sieve script.
static void toXml(org.apache.jsieve.parser.generated.Node node, java.io.Writer writer)
          Writes the given node as xml.
static void toXmlDocument(org.apache.jsieve.parser.generated.Node node, java.io.Writer writer)
          Writes the given node as xml.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OutputUtils

public OutputUtils()
Method Detail

toXmlDocument

public static void toXmlDocument(org.apache.jsieve.parser.generated.Node node,
                                 java.io.Writer writer)
                          throws java.io.IOException,
                                 SieveException

Writes the given node as xml. This convenience method first writes a prolog before calling toXml(Node, Writer).

The output format is a subset of the sieve-in-xml Internet Draft.

Parameters:
node - not null
writer - not null
Throws:
java.io.IOException - when prolog cannot be written
SieveException - when script cannot be converted to xml
See Also:
toXml(Node, Writer)

toXml

public static void toXml(org.apache.jsieve.parser.generated.Node node,
                         java.io.Writer writer)
                  throws SieveException

Writes the given node as xml. Note that the xml will be written as a fragment. An appropriate prolog must be added to convert this fragment to a document.

The output format is a subset of the sieve-in-xml Internet Draft. Note that this support is experimental.

Parameters:
node - not null
writer - not null
Throws:
SieveException - when script cannot be converted to xml
See Also:
XmlOut, SieveToXml, SieveHandler

toSieve

public static void toSieve(org.apache.jsieve.parser.generated.Node node,
                           java.io.Writer writer)
                    throws SieveException

Writes the tree rooted at the given node to a Sieve script.

Parameters:
node - not null
writer - not null
Throws:
SieveException - whenever the serialization fails


Copyright © 2008-2009 The Apache Software Foundation. All Rights Reserved.