org.apache.felix.scrplugin.xml

## Class IOUtils

- java.lang.Object
- - org.apache.felix.scrplugin.xml.IOUtils

    public class IOUtils
    extends Object

Utility class for xml/sax handling.

### Constructor Summary

Constructors
Constructor and Description
`IOUtils()`

### Method Summary

All Methods Static Methods Concrete Methods
`static void` `addAttribute(AttributesImpl ai, String name, Object value)` Helper method to add an attribute.
`static ContentHandler` `getSerializer(OutputStream outputStream)` Get a serializer to write XML to a file.
`static void` `indent(ContentHandler ch, int level)` Helper method to indent the xml elements.
`static void` `newline(ContentHandler ch)` Helper method to create a new line.
`static void` `parse(InputStream file, ContentHandler handler)` Parse a file and send the sax events to the content handler.
`static void` `text(ContentHandler ch, 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(InputStream file,
                                   ContentHandler handler)
                            throws TransformerException

Parse a file and send the sax events to the content handler.

Parameters:
  `file` -
  `handler` -
Throws:
  `TransformerException`

#### getSerializer

    public static ContentHandler getSerializer(OutputStream outputStream)
                                        throws TransformerException,
                                               IOException

Get a serializer to write XML to a file.

Throws:
  `TransformerException`
  `IOException`

#### addAttribute

    public static void addAttribute(AttributesImpl ai,
                                    String name,
                                    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(ContentHandler ch,
                            String text)
                     throws SAXException

Helper method writing out a string.

Parameters:
  `ch` - The content handler.
  `text` -
Throws:
  `SAXException`

#### indent

    public static void indent(ContentHandler ch,
                              int level)
                       throws 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:
  `SAXException`

#### newline

    public static void newline(ContentHandler ch)
                        throws SAXException

Helper method to create a new line.

Parameters:
  `ch` - The content handler.
Throws:
  `SAXException`