org.openstreetmap.osmosis.core.xml.common
Class BaseXmlWriter

java.lang.Object
  extended by org.openstreetmap.osmosis.core.xml.common.BaseXmlWriter
Direct Known Subclasses:
XmlChangeWriter, XmlChangeWriter, XmlWriter, XmlWriter

public abstract class BaseXmlWriter
extends java.lang.Object

An OSM data sink for storing all data to an xml file.

Author:
Brett Henderson

Constructor Summary
BaseXmlWriter(java.io.File file, CompressionMethod compressionMethod)
          Creates a new instance.
 
Method Summary
protected abstract  void beginElementWriter()
          Calls the begin method of the element writer used for this implementation.
 void complete()
          Flushes all changes to file.
protected abstract  void endElementWriter()
          Calls the end method of the element writer used for this implementation.
protected  void initialize()
          Initialises the output file for writing.
 void release()
          Cleans up any open file handles.
protected abstract  void setWriterOnElementWriter(java.io.BufferedWriter resultWriter)
          Sets the writer on the element writer used for this implementation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseXmlWriter

public BaseXmlWriter(java.io.File file,
                     CompressionMethod compressionMethod)
Creates a new instance.

Parameters:
file - The file to write.
compressionMethod - Specifies the compression method to employ.
Method Detail

setWriterOnElementWriter

protected abstract void setWriterOnElementWriter(java.io.BufferedWriter resultWriter)
Sets the writer on the element writer used for this implementation.

Parameters:
resultWriter - The writer receiving xml data.

beginElementWriter

protected abstract void beginElementWriter()
Calls the begin method of the element writer used for this implementation.


endElementWriter

protected abstract void endElementWriter()
Calls the end method of the element writer used for this implementation.


initialize

protected void initialize()
Initialises the output file for writing. This must be called by sub-classes before any writing is performed. This method may be called multiple times without adverse affect allowing sub-classes to invoke it every time they perform processing.


complete

public void complete()
Flushes all changes to file.


release

public void release()
Cleans up any open file handles.