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 theKMLDocinterface 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.FilekmlFileTheFilereference 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.InputStreamgetKMLStream()Returns anInputStreamto the KML file.java.lang.StringgetSupportFilePath(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.InputStreamgetSupportFileStream(java.lang.String path)Returns anInputStreamto a file indicated by a path relative to the KML file's location.java.io.FilegetZipFile()Returns theFilespecified to the constructor.
-
-
-
Method Detail
-
getZipFile
public java.io.File getZipFile()
Returns theFilespecified to the constructor.- Returns:
- the file specified to the constructor.
-
getKMLStream
public java.io.InputStream getKMLStream() throws java.io.IOExceptionReturns anInputStreamto the KML file.- Specified by:
getKMLStreamin 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.IOExceptionReturns anInputStreamto a file indicated by a path relative to the KML file's location.- Specified by:
getSupportFileStreamin 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:KMLDocReturns an absolute path or URL to a file indicated by a path relative to the KML file's location.- Specified by:
getSupportFilePathin 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.
-
-