public abstract class AbstractURLHandler extends java.lang.Object implements URLHandler
URLHandler.URLInfo
REQUEST_METHOD_GET, REQUEST_METHOD_HEAD, UNAVAILABLE
Constructor and Description |
---|
AbstractURLHandler() |
Modifier and Type | Method and Description |
---|---|
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.
|
protected java.io.InputStream |
getDecodingInputStream(java.lang.String encoding,
java.io.InputStream in) |
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.
|
int |
getRequestMethod() |
protected java.lang.String |
getUserAgent() |
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.
|
protected java.lang.String |
normalizeToString(java.net.URL url) |
protected java.net.URL |
normalizeToURL(java.net.URL url) |
void |
setRequestMethod(int requestMethod) |
protected void |
validatePutStatusCode(java.net.URL dest,
int statusCode,
java.lang.String statusMessage) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
download, getURLInfo, getURLInfo, openStream, upload
public boolean isReachable(java.net.URL url)
URLHandler
isReachable
in interface URLHandler
url
- the url to checkpublic boolean isReachable(java.net.URL url, int timeout)
URLHandler
isReachable
in interface URLHandler
url
- the url to checkpublic long getContentLength(java.net.URL url)
URLHandler
getContentLength
in interface URLHandler
url
- the url to checkpublic long getContentLength(java.net.URL url, int timeout)
URLHandler
getContentLength
in interface URLHandler
url
- 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)
URLHandler
getLastModified
in interface URLHandler
url
- the url to checkpublic long getLastModified(java.net.URL url, int timeout)
URLHandler
getLastModified
in interface URLHandler
url
- the url to checkprotected java.lang.String getUserAgent()
protected void validatePutStatusCode(java.net.URL dest, int statusCode, java.lang.String statusMessage) throws java.io.IOException
java.io.IOException
public void setRequestMethod(int requestMethod)
setRequestMethod
in interface URLHandler
public int getRequestMethod()
protected java.lang.String normalizeToString(java.net.URL url) throws java.io.IOException
java.io.IOException
protected java.net.URL normalizeToURL(java.net.URL url) throws java.io.IOException
java.io.IOException
protected java.io.InputStream getDecodingInputStream(java.lang.String encoding, java.io.InputStream in) throws java.io.IOException
java.io.IOException