NASA World Wind

gov.nasa.worldwindx.examples.kml
Class KMLDocumentBuilder

java.lang.Object
  extended by gov.nasa.worldwindx.examples.kml.KMLDocumentBuilder

public class KMLDocumentBuilder
extends Object

Utility class to create KML documents.


Field Summary
protected  XMLStreamWriter writer
           
 
Constructor Summary
KMLDocumentBuilder(OutputStream stream)
          Create a KML document using an OutputStream.
KMLDocumentBuilder(Writer writer)
          Create a KML document using a Writer.
 
Method Summary
 void close()
          Close the document builder.
protected  void endDocument()
          End the KML document.
protected  void startDocument()
          Start the KML document and write namespace declarations.
 void writeObject(Exportable exportable)
          Write an Exportable object to the document.
 void writeObjects(Exportable... exportables)
          Write a list of Exportable objects to the document.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

writer

protected XMLStreamWriter writer
Constructor Detail

KMLDocumentBuilder

public KMLDocumentBuilder(OutputStream stream)
                   throws XMLStreamException
Create a KML document using an OutputStream.

Parameters:
stream - Stream to receive KML output.
Throws:
XMLStreamException - If an error is encountered while writing KML.

KMLDocumentBuilder

public KMLDocumentBuilder(Writer writer)
                   throws XMLStreamException
Create a KML document using a Writer.

Parameters:
writer - Writer to receive KML output.
Throws:
XMLStreamException - If an error is encountered while writing KML.
Method Detail

close

public void close()
           throws XMLStreamException
Close the document builder.

Throws:
XMLStreamException - If an error is encountered while writing KML.

endDocument

protected void endDocument()
                    throws XMLStreamException
End the KML document.

Throws:
XMLStreamException - If an error is encountered while writing KML.

startDocument

protected void startDocument()
                      throws XMLStreamException
Start the KML document and write namespace declarations.

Throws:
XMLStreamException - If an error is encountered while writing KML.

writeObject

public void writeObject(Exportable exportable)
                 throws IOException
Write an Exportable object to the document. If the object does not support export in KML format, it will be ignored.

Parameters:
exportable - Object to export in KML.
Throws:
IOException - If an error is encountered while writing KML.

writeObjects

public void writeObjects(Exportable... exportables)
                  throws IOException
Write a list of Exportable objects to the document. If any objects do not support export in KML format, they will be ignored.

Parameters:
exportables - List of objects to export in KML.
Throws:
IOException - If an error is encountered while writing KML.

NASA World Wind