org.apache.felix.scrplugin.xml
Class IOUtils

java.lang.Object
  extended by org.apache.felix.scrplugin.xml.IOUtils

public class IOUtils
extends java.lang.Object

Utility class for xml/sax handling.


Constructor Summary
IOUtils()
           
 
Method Summary
static void addAttribute(org.xml.sax.helpers.AttributesImpl ai, java.lang.String name, java.lang.Object value)
          Helper method to add an attribute.
static org.xml.sax.ContentHandler getSerializer(java.io.File file)
          Get a serializer to write XML to a file.
static void indent(org.xml.sax.ContentHandler ch, int level)
          Helper method to indent the xml elements.
static void newline(org.xml.sax.ContentHandler ch)
          Helper method to create a new line.
static void parse(java.io.InputStream file, org.xml.sax.ContentHandler handler)
          Parse a file and send the sax events to the content handler.
static void text(org.xml.sax.ContentHandler ch, java.lang.String text)
          Helper method writing out a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IOUtils

public IOUtils()
Method Detail

parse

public static final void parse(java.io.InputStream file,
                               org.xml.sax.ContentHandler handler)
                        throws javax.xml.transform.TransformerException
Parse a file and send the sax events to the content handler.

Parameters:
file -
handler -
Throws:
javax.xml.transform.TransformerException

getSerializer

public static org.xml.sax.ContentHandler getSerializer(java.io.File file)
                                                throws javax.xml.transform.TransformerException,
                                                       java.io.IOException
Get a serializer to write XML to a file.

Throws:
javax.xml.transform.TransformerException
java.io.IOException

addAttribute

public static void addAttribute(org.xml.sax.helpers.AttributesImpl ai,
                                java.lang.String name,
                                java.lang.Object value)
Helper method to add an attribute. This implementation adds a new attribute with the given name and value. Before adding the value is checked for non-null.

Parameters:
ai - The attributes impl receiving the additional attribute.
name - The name of the attribute.
value - The value of the attribute.

text

public static void text(org.xml.sax.ContentHandler ch,
                        java.lang.String text)
                 throws org.xml.sax.SAXException
Helper method writing out a string.

Parameters:
ch - The content handler.
text -
Throws:
org.xml.sax.SAXException

indent

public static void indent(org.xml.sax.ContentHandler ch,
                          int level)
                   throws org.xml.sax.SAXException
Helper method to indent the xml elements. Each level is indented with four spaces.

Parameters:
ch - The content handler.
level - The level of indention.
Throws:
org.xml.sax.SAXException

newline

public static void newline(org.xml.sax.ContentHandler ch)
                    throws org.xml.sax.SAXException
Helper method to create a new line.

Parameters:
ch - The content handler.
Throws:
org.xml.sax.SAXException


Copyright © 2006-2013 The Apache Software Foundation. All Rights Reserved.