Interface Resource
-
public interface Resource
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
exists()
Check if this resource actually exists in physical form.String
getFilename()
Returns the filename of the resource.String
getPath()
Get full path of resource.boolean
isDirectory()
Check if this resource is a directory.Collection<Resource>
listResources()
Get all sub-resources: if the resource is not a directory, then this method should returns an empty list.InputStream
openStream()
Open anInputStream
.File
toFile()
Return a File handle for this resource.
-
-
-
Method Detail
-
exists
boolean exists()
Check if this resource actually exists in physical form.- Returns:
true
if the resource exists,false
otherwise.
-
toFile
File toFile()
Return a File handle for this resource.- Returns:
- The file associated to this resource.
-
openStream
InputStream openStream() throws IOException
Open anInputStream
. It is expected that each call of this method returns a new fresh instance ofInputStream
.- Returns:
- New
InputStream
. - Throws:
IOException
- If theInputStream
cannot be opened.
-
getFilename
String getFilename()
Returns the filename of the resource.- Returns:
- The filename.
-
getPath
String getPath()
Get full path of resource.- Returns:
- Full path.
-
isDirectory
boolean isDirectory()
Check if this resource is a directory.- Returns:
true
if the resource is a directory,false
otherwise.
-
listResources
Collection<Resource> listResources()
Get all sub-resources: if the resource is not a directory, then this method should returns an empty list.- Returns:
- Sub-resources.
-
-