Package gov.nasa.worldwindx.examples.kml
Class KMZDocumentBuilder
- java.lang.Object
-
- gov.nasa.worldwindx.examples.kml.KMZDocumentBuilder
-
public class KMZDocumentBuilder extends java.lang.Object
Utility 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 void
close()
Close the document builder.protected void
endDocument()
End the KMZ document.protected java.lang.String
getMainFileName()
Get the name of the KML file inside of the KMZ archive.protected void
startDocument()
Start the KMZ 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
-
KMZDocumentBuilder
public KMZDocumentBuilder(java.io.OutputStream stream) throws javax.xml.stream.XMLStreamException, java.io.IOException
Create 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.IOException
Start 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.IOException
End 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.IOException
Close 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 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.
-
-