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.
|
File |
getFile()
Gets file.
|
String |
getFilename()
Determine a filename for this resource, i.e. typically the last
part of the path: for example, "myfile.txt".
|
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 stream
null)IOException - if the stream could not be openedFile getFile()
Copyright © 2016. All rights reserved.