Package gov.nasa.worldwindx.examples.kml
Class KMZDocumentBuilder
- java.lang.Object
-
- gov.nasa.worldwindx.examples.kml.KMZDocumentBuilder
-
public class KMZDocumentBuilder extends java.lang.ObjectUtility class to create KMZ documents. The builder creates a KMZ archive with one KML file inside the archive. Objects that support export in KML format can be written to the KML file.
-
-
Constructor Summary
Constructors Constructor Description KMZDocumentBuilder(java.io.OutputStream stream)Create a KMZ document using an OutputStream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Close the document builder.protected voidendDocument()End the KMZ document.protected java.lang.StringgetMainFileName()Get the name of the KML file inside of the KMZ archive.protected voidstartDocument()Start the KMZ document and write namespace declarations.voidwriteObject(Exportable exportable)Write anExportableobject to the document.voidwriteObjects(Exportable... exportables)Write a list ofExportableobjects to the document.
-
-
-
Constructor Detail
-
KMZDocumentBuilder
public KMZDocumentBuilder(java.io.OutputStream stream) throws javax.xml.stream.XMLStreamException, java.io.IOExceptionCreate a KMZ document using an OutputStream.- Parameters:
stream- Stream to receive KMZ output.- Throws:
javax.xml.stream.XMLStreamException- If an exception is encountered while writing KML.java.io.IOException- If an exception occurs writing to the output stream.
-
-
Method Detail
-
getMainFileName
protected java.lang.String getMainFileName()
Get the name of the KML file inside of the KMZ archive.- Returns:
- The name of the KML file inside of the KMZ.
-
startDocument
protected void startDocument() throws javax.xml.stream.XMLStreamException, java.io.IOExceptionStart the KMZ document and write namespace declarations.- Throws:
javax.xml.stream.XMLStreamException- If an error is encountered while writing KML.java.io.IOException- If an exception occurs writing to the output stream.
-
endDocument
protected void endDocument() throws javax.xml.stream.XMLStreamException, java.io.IOExceptionEnd the KMZ document.- Throws:
javax.xml.stream.XMLStreamException- If an error is encountered while writing KML.java.io.IOException- If an exception occurs writing to the output stream.
-
close
public void close() throws javax.xml.stream.XMLStreamException, java.io.IOExceptionClose the document builder.- Throws:
javax.xml.stream.XMLStreamException- If an error is encountered while writing KML.java.io.IOException- If an exception occurs closing the output stream.
-
writeObject
public void writeObject(Exportable exportable) throws java.io.IOException
Write anExportableobject 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 ofExportableobjects 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.
-
-