Package org.citrusframework.spi
Interface Resource
- All Known Implementing Classes:
Resources.ByteArrayResource,Resources.ClasspathResource,Resources.FileSystemResource,Resources.UrlResource
public interface Resource
Describe a resource, such as a file or class path resource.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanexists()Whether this resource exists.getFile()Return the file associated with this resource.Returns anInputStreamthat reads from the underlying resource.The location of the resource.default ReaderReturns aReaderthat reads from the underlying resource using UTF-8 as charset.default Readerdefault URIgetURI()TheURIof the resource.default URLgetURL()TheURLfor the resource ornullif the URL can not be computed.
-
Method Details
-
getLocation
String getLocation()The location of the resource. -
exists
boolean exists()Whether this resource exists. -
getURI
TheURIof the resource. The default implementation creates aURIobject from resource location. -
getURL
TheURLfor the resource ornullif the URL can not be computed. The default implementation creates aURIobject from resource location.- Throws:
MalformedURLException
-
getInputStream
InputStream getInputStream()Returns anInputStreamthat reads from the underlying resource. Each invocation must return a newInputStreaminstance. -
getFile
File getFile()Return the file associated with this resource.- Returns:
-
getReader
Returns aReaderthat reads from the underlying resource using UTF-8 as charset. Each invocation must return a newReader.- Throws:
IOException- See Also:
-
getReader
Returns aReaderthat reads from the underlying resource using the givenCharsetEach invocation must return a newReader.- Throws:
IOException- See Also:
-