org.openstreetmap.josm.io
Class OsmChangeBuilder

java.lang.Object
  extended by org.openstreetmap.josm.io.OsmChangeBuilder

public class OsmChangeBuilder
extends java.lang.Object

Creates an OsmChange document from JOSM edits. See http://wiki.openstreetmap.org/index.php/OsmChange for a documentation of the OsmChange format.


Field Summary
private  java.lang.String apiVersion
           
private  java.lang.String currentMode
           
static java.lang.String DEFAULT_API_VERSION
           
private  OsmWriter osmwriter
           
private  boolean prologWritten
           
private  java.io.StringWriter swriter
           
private  java.io.PrintWriter writer
           
 
Constructor Summary
OsmChangeBuilder(Changeset changeset)
           
OsmChangeBuilder(Changeset changeset, java.lang.String apiVersion)
           
 
Method Summary
 void append(java.util.Collection<? extends IPrimitive> primitives)
          Appends a collection of Primitives to the OsmChange document.
 void append(IPrimitive p)
          Appends an Primitive to the OsmChange document.
 void finish()
          Writes the epilog of the OsmChange document
 java.lang.String getDocument()
           
 void start()
          Writes the prolog of the OsmChange document
private  void switchMode(java.lang.String newMode)
           
protected  void write(IPrimitive p)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_API_VERSION

public static final java.lang.String DEFAULT_API_VERSION
See Also:
Constant Field Values

currentMode

private java.lang.String currentMode

writer

private java.io.PrintWriter writer

swriter

private java.io.StringWriter swriter

osmwriter

private OsmWriter osmwriter

apiVersion

private java.lang.String apiVersion

prologWritten

private boolean prologWritten
Constructor Detail

OsmChangeBuilder

public OsmChangeBuilder(Changeset changeset)

OsmChangeBuilder

public OsmChangeBuilder(Changeset changeset,
                        java.lang.String apiVersion)
Method Detail

write

protected void write(IPrimitive p)

switchMode

private void switchMode(java.lang.String newMode)

start

public void start()
           throws java.lang.IllegalStateException
Writes the prolog of the OsmChange document

Throws:
java.lang.IllegalStateException - thrown if the prologs has already been written

append

public void append(java.util.Collection<? extends IPrimitive> primitives)
            throws java.lang.IllegalStateException
Appends a collection of Primitives to the OsmChange document.

Parameters:
primitives - the collection of primitives. Ignored if null.
Throws:
java.lang.IllegalStateException - thrown if the prologs has not been written yet
See Also:
start(), append(IPrimitive)

append

public void append(IPrimitive p)
Appends an Primitive to the OsmChange document.

Parameters:
p - the primitive. Ignored if null.
Throws:
java.lang.IllegalStateException - thrown if the prologs has not been written yet
See Also:
start(), append(Collection)

finish

public void finish()
            throws java.lang.IllegalStateException
Writes the epilog of the OsmChange document

Throws:
java.lang.IllegalStateException - thrown if the prologs has not been written yet

getDocument

public java.lang.String getDocument()


JOSM