Package gov.nasa.worldwindx.examples.kml
Class KMLDocumentBuilder
- java.lang.Object
-
- gov.nasa.worldwindx.examples.kml.KMLDocumentBuilder
-
public class KMLDocumentBuilder extends java.lang.Object
Utility class to create KML documents.
-
-
Field Summary
Fields Modifier and Type Field Description protected javax.xml.stream.XMLStreamWriter
writer
-
Constructor Summary
Constructors Constructor Description KMLDocumentBuilder(java.io.OutputStream stream)
Create a KML document using an OutputStream.KMLDocumentBuilder(java.io.Writer writer)
Create a KML document using a Writer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 anExportable
object to the document.void
writeObjects(Exportable... exportables)
Write a list ofExportable
objects to the document.
-
-
-
Constructor Detail
-
KMLDocumentBuilder
public KMLDocumentBuilder(java.io.Writer writer) throws javax.xml.stream.XMLStreamException
Create a KML document using a Writer.- Parameters:
writer
- Writer to receive KML output.- Throws:
javax.xml.stream.XMLStreamException
- If an error is encountered while writing KML.
-
KMLDocumentBuilder
public KMLDocumentBuilder(java.io.OutputStream stream) throws javax.xml.stream.XMLStreamException
Create a KML document using an OutputStream.- Parameters:
stream
- Stream to receive KML output.- Throws:
javax.xml.stream.XMLStreamException
- If an error is encountered while writing KML.
-
-
Method Detail
-
startDocument
protected void startDocument() throws javax.xml.stream.XMLStreamException
Start the KML document and write namespace declarations.- Throws:
javax.xml.stream.XMLStreamException
- If an error is encountered while writing KML.
-
endDocument
protected void endDocument() throws javax.xml.stream.XMLStreamException
End the KML document.- Throws:
javax.xml.stream.XMLStreamException
- If an error is encountered while writing KML.
-
close
public void close() throws javax.xml.stream.XMLStreamException
Close the document builder.- Throws:
javax.xml.stream.XMLStreamException
- If an error is encountered while writing KML.
-
writeObject
public void writeObject(Exportable exportable) throws java.io.IOException
Write anExportable
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:
java.io.IOException
- If an error is encountered while writing KML.
-
writeObjects
public void writeObjects(Exportable... exportables) throws java.io.IOException
Write a list ofExportable
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:
java.io.IOException
- If an error is encountered while writing KML.
-
-