Interface KMLDoc

  • All Known Implementing Classes:
    KMLFile, KMLInputStream, KMZFile, KMZInputStream

    public interface KMLDoc
    Defines the interface for opening a KML or KMZ file or stream and for resolving paths to files referenced by the KML content.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.io.InputStream getKMLStream()
      Returns an InputStream to the associated KML document within either a KML file or stream or a KMZ file or stream.
      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 a file specified by a path relative to the KML document.
    • Method Detail

      • getKMLStream

        java.io.InputStream getKMLStream()
                                  throws java.io.IOException
        Returns an InputStream to the associated KML document within either a KML file or stream or a KMZ file or stream.

        Implementations of this interface do not close the stream; the user of the class must close the stream.

        Returns:
        an input stream positioned to the head of the KML document.
        Throws:
        java.io.IOException - if an error occurs while attempting to create or open the input stream.
      • getSupportFileStream

        java.io.InputStream getSupportFileStream​(java.lang.String path)
                                          throws java.io.IOException
        Returns a file specified by a path relative to the KML document. If the document is in a KML file, the path is resolved relative to the KML file's location in the file system. If the document is in a KMZ file or stream, the path is resolved relative to the root of the KMZ file or stream. If the document is a KML stream, the relative path is resolved relative to the base URI of the stream, if a base URI has been specified.
        Parameters:
        path - the path of the requested file.
        Returns:
        an input stream positioned to the start of the requested file, or null if the file cannot be found.
        Throws:
        java.lang.IllegalArgumentException - if the path is null.
        java.io.IOException - if an error occurs while attempting to create or open the input stream.
      • getSupportFilePath

        java.lang.String getSupportFilePath​(java.lang.String path)
                                     throws java.io.IOException
        Returns an absolute path or URL to a file indicated by a path relative to the KML file's location.
        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.
        Throws:
        java.lang.IllegalArgumentException - if the specified path is null.
        java.io.IOException - if an error occurs while attempting to read the support file.