Class KMLInputStream

  • All Implemented Interfaces:
    KMLDoc

    public class KMLInputStream
    extends java.lang.Object
    implements KMLDoc
    Implements the KMLDoc interface for KML files read directly from input streams.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.io.InputStream inputStream
      The InputStream specified to the constructor.
      protected java.net.URI uri
      The URI of this KML document.
    • Constructor Summary

      Constructors 
      Constructor Description
      KMLInputStream​(java.io.InputStream sourceStream, java.net.URI uri)
      Construct a KMLInputStream instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.io.InputStream getKMLStream()
      Returns the input stream reference passed to the constructor.
      java.lang.String getSupportFilePath​(java.lang.String path)
      Resolve references against the document's URI.
      java.io.InputStream getSupportFileStream​(java.lang.String path)
      Resolve references against the document's URI.
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • inputStream

        protected java.io.InputStream inputStream
        The InputStream specified to the constructor.
      • uri

        protected java.net.URI uri
        The URI of this KML document. May be null.
    • Constructor Detail

      • KMLInputStream

        public KMLInputStream​(java.io.InputStream sourceStream,
                              java.net.URI uri)
                       throws java.io.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:
        java.lang.IllegalArgumentException - if the specified input stream is null.
        java.io.IOException - if an error occurs while attempting to read from the stream.
    • Method Detail

      • getKMLStream

        public java.io.InputStream getKMLStream()
                                         throws java.io.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:
        java.io.IOException - if an error occurs while attempting to create or open the input stream.
      • getSupportFileStream

        public java.io.InputStream getSupportFileStream​(java.lang.String path)
                                                 throws java.io.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:
        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)
        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.