@Deprecated
public interface DownloadSpec
Notable differences: Wayyy simpler implementation. Lazy evaluation of file and URL inputs. Single file downloads. External validation of file for up-to-date checking. UserAgent spoofing. (Thanks mojang!) Ability to set the ProgressLogger to use.
This is split into an Action, Spec and Task.
The Spec DownloadSpec, Provides the specification for how things work.
The Action DownloadAction, What actually handles downloading
implements DownloadSpec, Useful for other tasks that need to download
something but not necessarily create an entire task to do said download.
The Task DownloadTask for gradle, Task wrapper for DownloadAction,
implements DownloadSpec and hosts the Action as a task.
Created by covers1624 on 8/02/19.
| Modifier and Type | Method and Description |
|---|---|
void |
fileUpToDateWhen(java.util.function.Predicate<java.nio.file.Path> spec)
Deprecated.
Spec to validate the already existing file this DownloadSpec will download.
|
java.nio.file.Path |
getDest()
Deprecated.
Gets the destination file to download to.
|
java.nio.file.Path |
getETagFile()
Deprecated.
The file to store the ETag in.
|
DownloadListener |
getListener()
Deprecated.
Gets the currently attached
DownloadListener. |
boolean |
getOnlyIfModified()
Deprecated.
|
java.net.URL |
getSrc()
Deprecated.
Gets the source URL for the file that will be downloaded.
|
DownloadAction.UseETag |
getUseETag()
Deprecated.
|
java.lang.String |
getUserAgent()
Deprecated.
Gets the User-Agent header this DownloadSpec will use for requests.
|
boolean |
isQuiet()
Deprecated.
If this DownloadSpec is being quiet.
|
boolean |
isUpToDate()
Deprecated.
To be used after the DownloadSpec has been executed,
will return weather the DownloadSpec was up-to-date and
no work was performed.
|
default void |
setDest(java.io.File dest)
Deprecated.
Sets the destination to store the downloaded file.
|
void |
setDest(java.nio.file.Path dest)
Deprecated.
Sets the destination to store the downloaded file.
|
default void |
setETagFile(java.io.File eTagFile)
Deprecated.
Sets the file to store the ETag in.
|
void |
setETagFile(java.nio.file.Path eTagFile)
Deprecated.
Sets the file to store the ETag in.
|
void |
setListener(DownloadListener listener)
Deprecated.
Forcibly set the DownloadListener to use for this DownloadSpec.
|
void |
setOnlyIfModified(boolean onlyIfModified)
Deprecated.
Sets weather this DownloadSpec should obey onlyIfModified HTTP headers.
|
void |
setQuiet(boolean quiet)
Deprecated.
Sets weather quiet is enabled or not.
|
void |
setSrc(java.lang.Object src)
Deprecated.
Sets the source URL to download.
|
void |
setUseETag(java.lang.Object useETag)
Deprecated.
Sets weather this DownloadSpec should use ETags for HTTP requests.
|
void |
setUserAgent(java.lang.String userAgent)
Deprecated.
Sets the User-Agent HTTP header string to use for HTTP requests.
|
void fileUpToDateWhen(java.util.function.Predicate<java.nio.file.Path> spec)
Basically, using this allows you to determine externally if the file is corrupt and force a re-download at execution time instead of pre maturely.
spec - The Spec.java.net.URL getSrc()
java.nio.file.Path getDest()
boolean getOnlyIfModified()
DownloadAction.UseETag getUseETag()
java.nio.file.Path getETagFile()
java.lang.String getUserAgent()
boolean isQuiet()
boolean isUpToDate()
DownloadListener getListener()
DownloadListener.void setSrc(java.lang.Object src)
src - The source.void setDest(java.nio.file.Path dest)
dest - The destination.default void setDest(java.io.File dest)
dest - The destination.void setOnlyIfModified(boolean onlyIfModified)
onlyIfModified - Weather to use onlyIfModified.void setUseETag(java.lang.Object useETag)
useETag - Weather to use ETags.void setETagFile(java.nio.file.Path eTagFile)
eTagFile - The file to store the ETag in.default void setETagFile(java.io.File eTagFile)
eTagFile - The file to store the ETag in.void setUserAgent(java.lang.String userAgent)
userAgent - The User-Agent string.void setQuiet(boolean quiet)
quiet - If quiet is enabled.void setListener(DownloadListener listener)
listener - The DownloadListener.