NASA World Wind

gov.nasa.worldwind.ogc.kml.io
Interface KMLDoc

All Known Implementing Classes:
KMLFile, KMLInputStream, KMZFile, KMZInputStream

public interface KMLDoc

Defines the interface for opening a KML or KMZ file or stream and for resolving paths to files referenced by the KML content.


Method Summary
 InputStream getKMLStream()
          Returns an InputStream to the associated KML document within either a KML file or stream or a KMZ file or stream.
 String getSupportFilePath(String path)
          Returns an absolute path or URL to a file indicated by a path relative to the KML file's location.
 InputStream getSupportFileStream(String path)
          Returns a file specified by a path relative to the KML document.
 

Method Detail

getKMLStream

InputStream getKMLStream()
                         throws IOException
Returns an InputStream to the associated KML document within either a KML file or stream or a KMZ file or stream.

Implementations of this interface do not close the stream; the user of the class must close the stream.

Returns:
an input stream positioned to the head of the KML document.
Throws:
IOException - if an error occurs while attempting to create or open the input stream.

getSupportFilePath

String getSupportFilePath(String path)
                          throws IOException
Returns an absolute path or URL to a file indicated by a path relative to the KML file's location.

Parameters:
path - the path of the requested file.
Returns:
an absolute path or URL to the file, or null if the file does not exist.
Throws:
IllegalArgumentException - if the specified path is null.
IOException - if an error occurs while attempting to read the support file.

getSupportFileStream

InputStream getSupportFileStream(String path)
                                 throws IOException
Returns a file specified by a path relative to the KML document. If the document is in a KML file, the path is resolved relative to the KML file's location in the file system. If the document is in a KMZ file or stream, the path is resolved relative to the root of the KMZ file or stream. If the document is a KML stream, the relative path is resolved relative to the base URI of the stream, if a base URI has been specified.

Parameters:
path - the path of the requested file.
Returns:
an input stream positioned to the start of the requested file, or null if the file cannot be found.
Throws:
IllegalArgumentException - if the path is null.
IOException - if an error occurs while attempting to create or open the input stream.

NASA World Wind