public abstract class AbstractDownloadAction extends java.lang.Object implements DownloadAction
DownloadAction.Dest| Modifier and Type | Field and Description |
|---|---|
protected @Nullable DownloadAction.Dest |
dest |
protected @Nullable DownloadListener |
downloadListener |
protected java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
headers |
protected boolean |
onlyIfModified |
protected boolean |
quiet |
protected boolean |
upToDate |
protected @Nullable java.lang.String |
url |
protected boolean |
useETag |
protected @Nullable 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,
@Nullable java.util.Date lastModifiedHeader) |
protected boolean |
expectNotModified() |
@Nullable DownloadAction.Dest |
getDest() |
@Nullable DownloadListener |
getDownloadListener() |
boolean |
getOnlyIfModified() |
boolean |
getQuiet() |
@Nullable java.lang.String |
getUrl() |
boolean |
getUseETag() |
@Nullable java.lang.String |
getUserAgent() |
boolean |
isUpToDate() |
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, waitexecute@Nullable protected @Nullable java.lang.String url
@Nullable protected @Nullable DownloadAction.Dest dest
protected boolean onlyIfModified
protected boolean useETag
protected boolean quiet
@Nullable protected @Nullable java.lang.String userAgent
@Nullable protected @Nullable 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,
@Nullable
@Nullable 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 DownloadAction@Nullable public @Nullable java.lang.String getUrl()
getUrl in interface DownloadAction@Nullable public @Nullable DownloadAction.Dest getDest()
getDest in interface DownloadActionpublic boolean getOnlyIfModified()
getOnlyIfModified in interface DownloadActionpublic boolean getUseETag()
getUseETag in interface DownloadActionpublic boolean getQuiet()
getQuiet in interface DownloadAction@Nullable public @Nullable java.lang.String getUserAgent()
getUserAgent in interface DownloadAction@Nullable public @Nullable DownloadListener getDownloadListener()
getDownloadListener in interface DownloadAction