NASA World Wind

gov.nasa.worldwind.ogc.kml.io
Class KMLFile

java.lang.Object
  extended by gov.nasa.worldwind.ogc.kml.io.KMLFile
All Implemented Interfaces:
KMLDoc

public class KMLFile
extends Object
implements KMLDoc

Implements the KMLDoc interface for KML files located within a computer's file system.

Note: This class does not resolve references to files in KMZ archives. For example, it does not resolve references like this: ../other.kmz/file.png.


Field Summary
protected  File kmlFile
          The File reference specified to the constructor.
 
Constructor Summary
KMLFile(File file)
          Construct a KMLFile instance.
 
Method Summary
 InputStream getKMLStream()
          Returns an InputStream to the KML file.
 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 an InputStream to a file indicated by a path relative to the KML file's location.
 File getZipFile()
          Returns the File specified to the constructor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

kmlFile

protected File kmlFile
The File reference specified to the constructor.

Constructor Detail

KMLFile

public KMLFile(File file)
Construct a KMLFile instance.

Parameters:
file - path to the KML file.
Throws:
IllegalArgumentException - if the specified file is null.
Method Detail

getKMLStream

public InputStream getKMLStream()
                         throws IOException
Returns an InputStream to the KML file.

Specified by:
getKMLStream in interface KMLDoc
Returns:
an input stream positioned to the start of the KML file.
Throws:
IOException - if an error occurs attempting to create the input stream.

getSupportFilePath

public String getSupportFilePath(String path)
Description copied from interface: KMLDoc
Returns an absolute path or URL to a file indicated by a path relative to the KML file's location.

Specified by:
getSupportFilePath in interface KMLDoc
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.

getSupportFileStream

public InputStream getSupportFileStream(String path)
                                 throws IOException
Returns an InputStream to a file indicated by a path relative to the KML file's location.

Specified by:
getSupportFileStream in interface KMLDoc
Parameters:
path - the path of the requested file.
Returns:
an input stream positioned to the start of the file, or null if the file does not exist.
Throws:
IOException - if an error occurs while attempting to query or open the file.

getZipFile

public File getZipFile()
Returns the File specified to the constructor.

Returns:
the file specified to the constructor.

NASA World Wind