Class BaseXmlWriter

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

public abstract class BaseXmlWriter extends Object
An OSM data sink for storing all data to an xml file.
  • Constructor Details

    • BaseXmlWriter

      public BaseXmlWriter(BufferedWriter writer)
      Creates a new instance to write to the provided writer.
      Parameters:
      writer - The writer to receive data. This writer will not be closed on completion.
    • BaseXmlWriter

      public BaseXmlWriter(File file, CompressionMethod compressionMethod)
      Creates a new instance to write to the specified file.
      Parameters:
      file - The file to write.
      compressionMethod - Specifies the compression method to employ.
  • Method Details

    • setWriterOnElementWriter

      protected abstract void setWriterOnElementWriter(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

      public void initialize(Map<String,Object> metaData)
      Initialize the object.
      Parameters:
      metaData - Meta data applicable to this pipeline invocation.
    • 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.
    • close

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