Resource
1. Resource API
public interface InputStreamSource {
InputStream getInputStream() throws IOException;
}
public interface Resource extends InputStreamSource {
boolean exists();
boolean isReadable();
boolean isOpen();
URL getURL() throws IOException;
URI getURI() throws IOException;
File getFile() throws IOException;
long contentLength() throws IOException;
long lastModified() throws IOException;
Resource createRelative(String relativePath) throws IOException;
String getFilename();
String getDescription();
}
InputStreamSource:
getInputStream: Return new java.io.InputStream which needs close after used.
Resource extends InputStreamSource:
exists: Resource exists?
isReadable: Resource readable?
isOpen: Resource open?
getURL: java.util.URL.
getURI: java.util.URI.
URIs identify and URLs locate; however, locators are also identifiers, so every URL is also a URI, but there are URIs which are not URLs.
- getFile: java.io.File.
- contentLength: Resource length.
- lastModified_: Modified date.
- createRelateive: create file in Resource.
- getFilename: ONLY return file path.
- getDescription return full file path.