public interface Resource
An InputStream can be opened for every resource if it exists in physical form, but a URL or File handle can just be returned for certain resources. The actual behavior is implementation-specific. This is based originally off spring abstraction.
Modifier and Type | Method and Description |
---|---|
boolean |
exists()
Return whether this resource actually exists in physical form.
|
String |
getFilename()
Determine a filename for this resource, i.e.
|
InputStream |
getInputStream()
Return an
InputStream . |
boolean exists()
This method performs a definitive existence check, whereas the
existence of a Resource
handle only guarantees a
valid descriptor handle.
String getFilename()
Returns null
if this type of resource does not
have a filename.
InputStream getInputStream() throws IOException
InputStream
.
Caller is responsible for closing the streamnull
)IOException
- if the stream could not be openedCopyright © 2016. All rights reserved.