Package org.apache.camel.spi
Interface Resource
-
public interface Resource
Describe 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 boolean
exists()
Whether this resource exists.InputStream
getInputStream()
Returns anInputStream
that reads from the underlying resource.String
getLocation()
The location of the resource.default Reader
getReader()
Returns aReader
that reads from the underlying resource using UTF-8 as charset.default Reader
getReader(Charset charset)
String
getScheme()
The scheme of the resource such as file, classpath, httpdefault URI
getURI()
TheURI
of the resource.default URL
getURL()
TheURL
for the resource ornull
if 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()
TheURI
of the resource. The default implementation creates aURI
object from resource location.
-
getURL
default URL getURL() throws MalformedURLException
TheURL
for the resource ornull
if the URL can not be computed. The default implementation creates aURI
object from resource location.- Throws:
MalformedURLException
-
getInputStream
InputStream getInputStream() throws IOException
Returns anInputStream
that reads from the underlying resource. Each invocation must return a newInputStream
instance.- Throws:
IOException
-
getReader
default Reader getReader() throws Exception
Returns aReader
that reads from the underlying resource using UTF-8 as charset. Each invocation must return a newReader
.- Throws:
Exception
- See Also:
getInputStream()
-
-