org.apache.ddlutils.io
Class DataWriter

java.lang.Object
  extended by org.apache.ddlutils.io.DataWriter

public class DataWriter
extends Object

Writes dyna beans matching a specified database model into an XML file. TODO: Make names (tables, columns) XML-compliant

Version:
$Revision: 289996 $

Constructor Summary
DataWriter(OutputStream output)
          Creates a data writer instance using UTF-8 encoding.
DataWriter(OutputStream output, String encoding)
          Creates a data writer instance.
DataWriter(Writer output, String encoding)
          Creates a data writer instance using the specified writer.
 
Method Summary
 ConverterConfiguration getConverterConfiguration()
          Returns the converter configuration of this data reader.
 boolean isPrettyPrinting()
          Determines whether the output shall be pretty-printed.
 void setPrettyPrinting(boolean prettyPrinting)
          Specifies whether the output shall be pretty-printed.
 void write(Collection beans)
          Writes the beans contained in the given collection.
 void write(Iterator beans)
          Writes the beans contained in the given iterator.
 void write(SqlDynaBean bean)
          Writes the given bean.
 void writeDocumentEnd()
          Writes the end of the XML document, i.e.
 void writeDocumentStart()
          Writes the start of the XML document, i.e.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataWriter

public DataWriter(OutputStream output)
           throws DataWriterException
Creates a data writer instance using UTF-8 encoding.

Parameters:
output - The target to write the data XML to
Throws:
DataWriterException

DataWriter

public DataWriter(OutputStream output,
                  String encoding)
           throws DataWriterException
Creates a data writer instance.

Parameters:
output - The target to write the data XML to
encoding - The encoding of the XML file
Throws:
DataWriterException

DataWriter

public DataWriter(Writer output,
                  String encoding)
           throws DataWriterException
Creates a data writer instance using the specified writer. Note that the writer needs to be configured using the specified encoding.

Parameters:
output - The target to write the data XML to
encoding - The encoding of the writer
Throws:
DataWriterException
Method Detail

isPrettyPrinting

public boolean isPrettyPrinting()
Determines whether the output shall be pretty-printed.

Returns:
true if the output is pretty-printed

setPrettyPrinting

public void setPrettyPrinting(boolean prettyPrinting)
Specifies whether the output shall be pretty-printed.

Parameters:
prettyPrinting - true if the output is pretty-printed

getConverterConfiguration

public ConverterConfiguration getConverterConfiguration()
Returns the converter configuration of this data reader.

Returns:
The converter configuration

writeDocumentStart

public void writeDocumentStart()
                        throws DataWriterException
Writes the start of the XML document, i.e. the "" section and the start of the root node.

Throws:
DataWriterException

writeDocumentEnd

public void writeDocumentEnd()
                      throws DataWriterException
Writes the end of the XML document, i.e. end of the root node.

Throws:
DataWriterException

write

public void write(SqlDynaBean bean)
           throws DataWriterException
Writes the given bean.

Parameters:
bean - The bean to write
Throws:
DataWriterException

write

public void write(Iterator beans)
           throws DataWriterException
Writes the beans contained in the given iterator.

Parameters:
beans - The beans iterator
Throws:
DataWriterException

write

public void write(Collection beans)
           throws DataWriterException
Writes the beans contained in the given collection.

Parameters:
beans - The beans
Throws:
DataWriterException


Copyright © 2005-2007 Apache Software Foundation. All Rights Reserved.