Package org.apache.calcite.util
Class Sources.FileSource
- java.lang.Object
-
- org.apache.calcite.util.Sources.FileSource
-
-
Constructor Summary
Constructors Modifier Constructor Description private
FileSource(java.io.File file)
private
FileSource(java.net.URL url)
-
Method Summary
All Methods Instance Methods Concrete 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 parent)
Returns a relative source, if this source is a child of a given base.java.lang.String
toString()
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()
private java.io.File
urlToFile(java.net.URL url)
-
-
-
Method Detail
-
urlToFile
private java.io.File urlToFile(java.net.URL url)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
reader
public java.io.Reader reader() throws java.io.IOException
-
openStream
public java.io.InputStream openStream() throws java.io.IOException
- Specified by:
openStream
in interfaceSource
- Throws:
java.io.IOException
-
trim
public Source trim(java.lang.String suffix)
Description copied from interface:Source
Looks for a suffix on a path and returns either the path with the suffix removed or the original path.
-
trimOrNull
public Source trimOrNull(java.lang.String suffix)
Description copied from interface:Source
Looks for a suffix on a path and returns either the path with the suffix removed or null.- Specified by:
trimOrNull
in interfaceSource
-
append
public Source append(Source child)
Description copied from interface:Source
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
public Source relative(Source parent)
Description copied from interface: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")
-
-