Interface Source


public interface Source
Source of data.
  • Method Details

    • url

      URL url()
    • file

      File file()
    • fileOpt

      Optional<File> fileOpt()
    • path

      String path()
    • reader

      Reader reader() throws IOException
      Throws:
      IOException
    • openStream

      InputStream openStream() throws IOException
      Throws:
      IOException
    • protocol

      String protocol()
    • trim

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

      @Nullable Source trimOrNull(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")