public class URLHandlerDispatcher extends java.lang.Object implements URLHandler
URLHandler.URLInfoREQUEST_METHOD_GET, REQUEST_METHOD_HEAD, UNAVAILABLE| Constructor and Description |
|---|
URLHandlerDispatcher() |
| 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.
|
URLHandler |
getDefault() |
URLHandler |
getHandler(java.lang.String protocol) |
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
URLHandler.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 |
setDefault(URLHandler default1) |
void |
setDownloader(java.lang.String protocol,
URLHandler downloader) |
void |
setRequestMethod(int requestMethod) |
void |
upload(java.io.File src,
java.net.URL dest,
CopyProgressListener l) |
public boolean isReachable(java.net.URL url)
URLHandlerisReachable in interface URLHandlerurl - the url to checkpublic boolean isReachable(java.net.URL url,
int timeout)
URLHandlerisReachable in interface URLHandlerurl - the url to checkpublic long getContentLength(java.net.URL url)
URLHandlergetContentLength in interface URLHandlerurl - the url to checkpublic long getContentLength(java.net.URL url,
int timeout)
URLHandlergetContentLength in interface URLHandlerurl - the url to checktimeout - the maximum time before considering an url is not reachable a timeout of zero
indicates no timeoutpublic long getLastModified(java.net.URL url)
URLHandlergetLastModified in interface URLHandlerurl - the url to checkpublic long getLastModified(java.net.URL url,
int timeout)
URLHandlergetLastModified in interface URLHandlerurl - the url to checkpublic URLHandler.URLInfo getURLInfo(java.net.URL url)
URLHandlerURLHandler.UNAVAILABLE instance, if the url is not
reachable.getURLInfo in interface URLHandlerurl - The url from which information is retrieved.URLHandler.UNAVAILABLE when the url is not
available.public URLHandler.URLInfo getURLInfo(java.net.URL url, int timeout)
URLHandlergetURLInfo in interface URLHandlerurl - The url from which information is retrieved.timeout - The timeout in milliseconds.URLHandler.UNAVAILABLE when the url is not
available.public java.io.InputStream openStream(java.net.URL url)
throws java.io.IOException
openStream in interface URLHandlerjava.io.IOExceptionpublic void download(java.net.URL src,
java.io.File dest,
CopyProgressListener l)
throws java.io.IOException
download in interface URLHandlerjava.io.IOExceptionpublic void upload(java.io.File src,
java.net.URL dest,
CopyProgressListener l)
throws java.io.IOException
upload in interface URLHandlerjava.io.IOExceptionpublic void setRequestMethod(int requestMethod)
setRequestMethod in interface URLHandlerpublic void setDownloader(java.lang.String protocol,
URLHandler downloader)
public URLHandler getHandler(java.lang.String protocol)
public URLHandler getDefault()
public void setDefault(URLHandler default1)