Package org.apache.camel.spi
Interface Resource
-
public interface ResourceDescribe a resource, such as a file or class path resource.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description booleanexists()Whether this resource exists.InputStreamgetInputStream()Returns anInputStreamthat reads from the underlying resource.StringgetLocation()The location of the resource.default ReadergetReader()Returns aReaderthat reads from the underlying resource using UTF-8 as charset.default ReadergetReader(Charset charset)StringgetScheme()The scheme of the resource such as file, classpath, httpdefault URIgetURI()TheURIof the resource.default URLgetURL()TheURLfor the resource ornullif the URL can not be computed.
-
-
-
Method Detail
-
getScheme
String getScheme()
The scheme of the resource such as file, classpath, http
-
getLocation
String getLocation()
The location of the resource.
-
exists
boolean exists()
Whether this resource exists.
-
getURI
default URI getURI()
TheURIof the resource. The default implementation creates aURIobject from resource location.
-
getURL
default URL getURL() throws MalformedURLException
TheURLfor the resource ornullif the URL can not be computed. The default implementation creates aURIobject from resource location.- Throws:
MalformedURLException
-
getInputStream
InputStream getInputStream() throws IOException
Returns anInputStreamthat reads from the underlying resource. Each invocation must return a newInputStreaminstance.- Throws:
IOException
-
getReader
default Reader getReader() throws Exception
Returns aReaderthat reads from the underlying resource using UTF-8 as charset. Each invocation must return a newReader.- Throws:
Exception- See Also:
getInputStream()
-
-