NASA World Wind

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

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

public class KMLInputStream
extends Object
implements KMLDoc

Implements the KMLDoc interface for KML files read directly from input streams.


Field Summary
protected  InputStream inputStream
          The InputStream specified to the constructor.
protected  URI uri
          The URI of this KML document.
 
Constructor Summary
KMLInputStream(InputStream sourceStream, URI uri)
          Construct a KMLInputStream instance.
 
Method Summary
 InputStream getKMLStream()
          Returns the input stream reference passed to the constructor.
 String getSupportFilePath(String path)
          Resolve references against the document's URI.
 InputStream getSupportFileStream(String path)
          Resolve references against the document's URI.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

inputStream

protected InputStream inputStream
The InputStream specified to the constructor.


uri

protected URI uri
The URI of this KML document. May be null.

Constructor Detail

KMLInputStream

public KMLInputStream(InputStream sourceStream,
                      URI uri)
               throws IOException
Construct a KMLInputStream instance.

Parameters:
sourceStream - the KML stream.
uri - the URI of this KML document. This URI is used to resolve relative references. May be null.
Throws:
IllegalArgumentException - if the specified input stream is null.
IOException - if an error occurs while attempting to read from the stream.
Method Detail

getKMLStream

public InputStream getKMLStream()
                         throws IOException
Returns the input stream reference passed to the constructor.

Specified by:
getKMLStream in interface KMLDoc
Returns:
the input stream reference passed to the constructor.
Throws:
IOException - if an error occurs while attempting to create or open the input stream.

getSupportFilePath

public String getSupportFilePath(String path)
Resolve references against the document's URI.

Specified by:
getSupportFilePath in interface KMLDoc
Parameters:
path - the path of the requested file.
Returns:
a URL to the requested file, or null if the document does not have a base URI.

getSupportFileStream

public InputStream getSupportFileStream(String path)
                                 throws IOException
Resolve references against the document's URI.

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.

NASA World Wind