public interface URLHandler
Modifier and Type | Interface and Description |
---|---|
static class |
URLHandler.URLInfo |
Modifier and Type | Field and Description |
---|---|
static int |
REQUEST_METHOD_GET
Using the slower REQUEST method for getting the basic URL infos.
|
static int |
REQUEST_METHOD_HEAD
Using the faster HEAD method for getting the basic URL infos.
|
static URLHandler.URLInfo |
UNAVAILABLE |
Modifier and Type | Method and Description |
---|---|
void |
download(java.net.URL src,
java.io.File dest,
CopyProgressListener l) |
long |
getContentLength(java.net.URL url)
Returns the length of the target if the given url is reachable, and without error code in
case of http urls.
|
long |
getContentLength(java.net.URL url,
int timeout)
Returns the length of the target if the given url is reachable, and without error code in
case of http urls.
|
long |
getLastModified(java.net.URL url)
Please prefer getURLInfo when several infos are needed.
|
long |
getLastModified(java.net.URL url,
int timeout)
Please prefer getURLInfo when several infos are needed.
|
URLHandler.URLInfo |
getURLInfo(java.net.URL url)
Returns the URLInfo of the given url or a
UNAVAILABLE instance, if the url is not
reachable. |
URLHandler.URLInfo |
getURLInfo(java.net.URL url,
int timeout)
never returns null, return UNAVAILABLE when url is not reachable
|
boolean |
isReachable(java.net.URL url)
Please prefer getURLInfo when several infos are needed.
|
boolean |
isReachable(java.net.URL url,
int timeout)
Please prefer getURLInfo when several infos are needed.
|
java.io.InputStream |
openStream(java.net.URL url) |
void |
setRequestMethod(int requestMethod) |
void |
upload(java.io.File src,
java.net.URL dest,
CopyProgressListener l) |
static final int REQUEST_METHOD_GET
static final int REQUEST_METHOD_HEAD
static final URLHandler.URLInfo UNAVAILABLE
boolean isReachable(java.net.URL url)
url
- the url to checkboolean isReachable(java.net.URL url, int timeout)
url
- the url to checklong getContentLength(java.net.URL url)
url
- the url to checklong getContentLength(java.net.URL url, int timeout)
url
- the url to checktimeout
- the maximum time before considering an url is not reachable a timeout of zero
indicates no timeoutlong getLastModified(java.net.URL url)
url
- the url to checklong getLastModified(java.net.URL url, int timeout)
url
- the url to checkURLHandler.URLInfo getURLInfo(java.net.URL url)
UNAVAILABLE
instance, if the url is not
reachable.url
- The url from which information is retrieved.UNAVAILABLE
when the url is not
available.URLHandler.URLInfo getURLInfo(java.net.URL url, int timeout)
url
- The url from which information is retrieved.timeout
- The timeout in milliseconds.UNAVAILABLE
when the url is not
available.java.io.InputStream openStream(java.net.URL url) throws java.io.IOException
java.io.IOException
void download(java.net.URL src, java.io.File dest, CopyProgressListener l) throws java.io.IOException
java.io.IOException
void upload(java.io.File src, java.net.URL dest, CopyProgressListener l) throws java.io.IOException
java.io.IOException
void setRequestMethod(int requestMethod)