com.metamatrix.common.xml
Class XMLReaderWriterImpl

java.lang.Object
  extended by com.metamatrix.common.xml.XMLReaderWriterImpl
All Implemented Interfaces:
XMLReaderWriter

public class XMLReaderWriterImpl
extends java.lang.Object
implements XMLReaderWriter

This implementation will use the JDOMhelper to read in XML files and will use the JDOM utility to write out JDOM XML files.


Field Summary
static int DEFAULT_INDENT_SIZE
           
static boolean DEFAULT_USE_NEW_LINES
           
 
Constructor Summary
XMLReaderWriterImpl()
           
 
Method Summary
 org.jdom.Document readDocument(java.io.InputStream stream)
          This method will write a JDOM Document to an OutputStream.
 void setIndentSize(int indent)
          This method will set the indent size of all JDOM Documents that are written using this object.
 void setUseNewLines(boolean newLines)
          This method will set whether or not new Lines are used to mimic the hierarchal structure of all JDOM Documents that are written using this object.
 void writeDocument(org.jdom.Document doc, java.io.OutputStream stream)
          This method will write a JDOM Document to an OutputStream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_INDENT_SIZE

public static final int DEFAULT_INDENT_SIZE
See Also:
Constant Field Values

DEFAULT_USE_NEW_LINES

public static final boolean DEFAULT_USE_NEW_LINES
See Also:
Constant Field Values
Constructor Detail

XMLReaderWriterImpl

public XMLReaderWriterImpl()
Method Detail

writeDocument

public void writeDocument(org.jdom.Document doc,
                          java.io.OutputStream stream)
                   throws java.io.IOException
This method will write a JDOM Document to an OutputStream.

Specified by:
writeDocument in interface XMLReaderWriter
Parameters:
doc - the JDOM document to be written to the OutputStream
stream - the output stream to be written to.
Throws:
java.io.IOException - if there is a problem writing to the OutputStream

readDocument

public org.jdom.Document readDocument(java.io.InputStream stream)
                               throws org.jdom.JDOMException,
                                      java.io.IOException
This method will write a JDOM Document to an OutputStream.

Specified by:
readDocument in interface XMLReaderWriter
Parameters:
stream - the input stream to read the XML document from.
Returns:
the JDOM document reference that represents the XML text in the InputStream.
Throws:
java.io.IOException - if there is a problem reading from the InputStream
org.jdom.JDOMException - if the InputStream does not represent a JDOM compliant XML document.

setIndentSize

public void setIndentSize(int indent)
This method will set the indent size of all JDOM Documents that are written using this object.

Parameters:
indent - the number of spaces to indent the XML heirarchy in the output files.

setUseNewLines

public void setUseNewLines(boolean newLines)
This method will set whether or not new Lines are used to mimic the hierarchal structure of all JDOM Documents that are written using this object.

Parameters:
newLines - whether or not to include new line chars in output files.


Copyright © 2009. All Rights Reserved.