public abstract class AbstractDownloadAction extends java.lang.Object implements DownloadAction
DownloadAction.Dest| Modifier and Type | Field and Description |
|---|---|
protected DownloadAction.Dest |
dest |
protected DownloadListener |
downloadListener |
protected static java.text.SimpleDateFormat |
FORMAT_ASCTIME |
protected static java.text.SimpleDateFormat |
FORMAT_RFC1036 |
protected static java.text.SimpleDateFormat |
FORMAT_RFC1123 |
protected java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
headers |
protected boolean |
onlyIfModified |
protected static java.text.SimpleDateFormat[] |
PATTERNS |
protected boolean |
quiet |
protected boolean |
upToDate |
protected java.lang.String |
url |
protected boolean |
useETag |
protected java.lang.String |
userAgent |
| Constructor and Description |
|---|
AbstractDownloadAction() |
| Modifier and Type | Method and Description |
|---|---|
DownloadAction |
addRequestHeader(java.lang.String key,
java.lang.String value)
Adds an arbitrary Http header to the action.
|
protected boolean |
calcUpToDate(int code,
long lastModifiedDisk,
java.util.Date lastModifiedHeader) |
protected boolean |
expectNotModified() |
DownloadAction.Dest |
getDest() |
DownloadListener |
getDownloadListener() |
boolean |
getOnlyIfModified() |
boolean |
getQuiet() |
java.lang.String |
getUrl() |
boolean |
getUseETag() |
java.lang.String |
getUserAgent() |
boolean |
isUpToDate() |
protected static java.util.Date |
parseDate(java.lang.String str) |
AbstractDownloadAction |
setDest(DownloadAction.Dest dest)
Set the Destination to download content to.
|
AbstractDownloadAction |
setDest(java.io.File file)
Set the
File to download content to. |
AbstractDownloadAction |
setDest(java.io.OutputStream os)
Set the
OutputStream to download content to. |
AbstractDownloadAction |
setDest(java.nio.file.Path path)
Set the
Path to download content to. |
AbstractDownloadAction |
setDest(java.io.StringWriter sw)
Set the
StringWriter to download content to. |
AbstractDownloadAction |
setDownloadListener(DownloadListener downloadListener)
Set the
DownloadListener to use. |
AbstractDownloadAction |
setOnlyIfModified(boolean onlyIfModified)
If this Download action should use
If-Modified-Since
HTTP request header. |
AbstractDownloadAction |
setQuiet(boolean quiet)
If this download action should not log things.
|
AbstractDownloadAction |
setUrl(java.lang.String url)
Set the URL to download from.
|
AbstractDownloadAction |
setUseETag(boolean useETag)
If this download action should use
If-None-Match
HTTP request header. |
AbstractDownloadAction |
setUserAgent(java.lang.String userAgent)
Sets the
User-Agent HTTP request header. |
protected void |
validateCode(int code,
java.lang.String reasonPhrase) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitexecuteprotected static final java.text.SimpleDateFormat FORMAT_RFC1123
protected static final java.text.SimpleDateFormat FORMAT_RFC1036
protected static final java.text.SimpleDateFormat FORMAT_ASCTIME
protected static final java.text.SimpleDateFormat[] PATTERNS
protected java.lang.String url
protected DownloadAction.Dest dest
protected boolean onlyIfModified
protected boolean useETag
protected boolean quiet
protected java.lang.String userAgent
protected DownloadListener downloadListener
protected final java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers
protected boolean upToDate
protected boolean expectNotModified()
protected void validateCode(int code,
java.lang.String reasonPhrase)
throws HttpResponseException
HttpResponseExceptionprotected boolean calcUpToDate(int code,
long lastModifiedDisk,
java.util.Date lastModifiedHeader)
public AbstractDownloadAction setUrl(java.lang.String url)
DownloadActionsetUrl in interface DownloadActionurl - The URL.public AbstractDownloadAction setDest(DownloadAction.Dest dest)
DownloadActionsetDest in interface DownloadActiondest - The Destination.public AbstractDownloadAction setDest(java.io.StringWriter sw)
DownloadActionStringWriter to download content to.setDest in interface DownloadActionsw - The StringWriter.public AbstractDownloadAction setDest(java.io.OutputStream os)
DownloadActionOutputStream to download content to.setDest in interface DownloadActionos - The OutputStream.public AbstractDownloadAction setDest(java.io.File file)
DownloadActionFile to download content to.setDest in interface DownloadActionfile - The file.public AbstractDownloadAction setDest(java.nio.file.Path path)
DownloadActionPath to download content to.setDest in interface DownloadActionpath - The path.public AbstractDownloadAction setOnlyIfModified(boolean onlyIfModified)
DownloadActionIf-Modified-Since
HTTP request header.setOnlyIfModified in interface DownloadActiononlyIfModified - If If-Modified-Since should be used.public AbstractDownloadAction setUseETag(boolean useETag)
DownloadActionIf-None-Match
HTTP request header.setUseETag in interface DownloadActionuseETag - If If-None-Match should be used.public AbstractDownloadAction setQuiet(boolean quiet)
DownloadActionsetQuiet in interface DownloadActionquiet - If the download action should be quiet.public AbstractDownloadAction setUserAgent(java.lang.String userAgent)
DownloadActionUser-Agent HTTP request header.setUserAgent in interface DownloadActionuserAgent - The User-Agent request header.public DownloadAction addRequestHeader(java.lang.String key, java.lang.String value)
DownloadActionaddRequestHeader in interface DownloadActionkey - The key.value - The value.public AbstractDownloadAction setDownloadListener(DownloadListener downloadListener)
DownloadActionDownloadListener to use.setDownloadListener in interface DownloadActiondownloadListener - The DownloadListener.public boolean isUpToDate()
isUpToDate in interface DownloadActionprotected static java.util.Date parseDate(java.lang.String str)
public java.lang.String getUrl()
getUrl in interface DownloadActionpublic DownloadAction.Dest getDest()
getDest in interface DownloadActionpublic boolean getOnlyIfModified()
getOnlyIfModified in interface DownloadActionpublic boolean getUseETag()
getUseETag in interface DownloadActionpublic boolean getQuiet()
getQuiet in interface DownloadActionpublic java.lang.String getUserAgent()
getUserAgent in interface DownloadActionpublic DownloadListener getDownloadListener()
getDownloadListener in interface DownloadAction