Package gov.nasa.worldwind.ogc.kml.io
Class KMLFile
- java.lang.Object
-
- gov.nasa.worldwind.ogc.kml.io.KMLFile
-
- All Implemented Interfaces:
KMLDoc
public class KMLFile extends java.lang.Object implements KMLDoc
Implements theKMLDoc
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
Fields Modifier and Type Field Description protected java.io.File
kmlFile
TheFile
reference specified to the constructor.
-
Constructor Summary
Constructors Constructor Description KMLFile(java.io.File file)
Construct a KMLFile instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.io.InputStream
getKMLStream()
Returns anInputStream
to the KML file.java.lang.String
getSupportFilePath(java.lang.String path)
Returns an absolute path or URL to a file indicated by a path relative to the KML file's location.java.io.InputStream
getSupportFileStream(java.lang.String path)
Returns anInputStream
to a file indicated by a path relative to the KML file's location.java.io.File
getZipFile()
Returns theFile
specified to the constructor.
-
-
-
Method Detail
-
getZipFile
public java.io.File getZipFile()
Returns theFile
specified to the constructor.- Returns:
- the file specified to the constructor.
-
getKMLStream
public java.io.InputStream getKMLStream() throws java.io.IOException
Returns anInputStream
to the KML file.- Specified by:
getKMLStream
in interfaceKMLDoc
- Returns:
- an input stream positioned to the start of the KML file.
- Throws:
java.io.IOException
- if an error occurs attempting to create the input stream.
-
getSupportFileStream
public java.io.InputStream getSupportFileStream(java.lang.String path) throws java.io.IOException
Returns anInputStream
to a file indicated by a path relative to the KML file's location.- Specified by:
getSupportFileStream
in interfaceKMLDoc
- 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:
java.io.IOException
- if an error occurs while attempting to query or open the file.
-
getSupportFilePath
public java.lang.String getSupportFilePath(java.lang.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 interfaceKMLDoc
- 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.
-
-