Interface Source

  • All Known Implementing Classes:
    Sources.FileSource

    public interface Source
    Source of data.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      Source append​(Source child)
      Returns a source whose path concatenates this with a child.
      java.io.File file()  
      java.io.InputStream openStream()  
      java.lang.String path()  
      java.lang.String protocol()  
      java.io.Reader reader()  
      Source relative​(Source source)
      Returns a relative source, if this source is a child of a given base.
      Source trim​(java.lang.String suffix)
      Looks for a suffix on a path and returns either the path with the suffix removed or the original path.
      Source trimOrNull​(java.lang.String suffix)
      Looks for a suffix on a path and returns either the path with the suffix removed or null.
      java.net.URL url()  
    • Method Detail

      • url

        java.net.URL url()
      • file

        java.io.File file()
      • path

        java.lang.String path()
      • reader

        java.io.Reader reader()
                       throws java.io.IOException
        Throws:
        java.io.IOException
      • openStream

        java.io.InputStream openStream()
                                throws java.io.IOException
        Throws:
        java.io.IOException
      • protocol

        java.lang.String protocol()
      • trim

        Source trim​(java.lang.String suffix)
        Looks for a suffix on a path and returns either the path with the suffix removed or the original path.
      • trimOrNull

        Source trimOrNull​(java.lang.String suffix)
        Looks for a suffix on a path and returns either the path with the suffix removed or null.
      • append

        Source append​(Source child)
        Returns a source whose path concatenates this with a child.

        For example,

        • source("/foo").append(source("bar")) returns source("/foo/bar")
        • source("/foo").append(source("/bar")) returns source("/bar") because "/bar" was already absolute
      • relative

        Source relative​(Source source)
        Returns a relative source, if this source is a child of a given base.

        For example,

        • source("/foo/bar").relative(source("/foo")) returns source("bar")
        • source("/baz/bar").relative(source("/foo")) returns source("/baz/bar")