public class Download extends org.gradle.api.DefaultTask implements DownloadSpec
task downloadFile(type: Download) {
src 'http://www.example.com/file.ext'
dest buildDir
}
| Constructor and Description |
|---|
Download()
Default constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
acceptAnyCertificate(boolean accept)
Specifies if HTTPS certificate verification errors should be ignored
and any certificate (even an invalid one) should be accepted.
|
void |
compress(boolean compress)
Specifies if compression should be used during download
|
void |
dest(java.lang.Object dest)
Sets the download destination
|
void |
download()
Starts downloading
|
java.io.File |
getDest() |
java.lang.String |
getHeader(java.lang.String name) |
java.util.Map<java.lang.String,java.lang.String> |
getHeaders() |
java.util.List<java.io.File> |
getOutputFiles() |
java.lang.String |
getPassword() |
java.lang.Object |
getSrc() |
java.lang.String |
getUsername() |
void |
header(java.lang.String name,
java.lang.String value)
Sets an HTTP request header to use when downloading
|
void |
headers(java.util.Map<java.lang.String,java.lang.String> headers)
Sets the HTTP request headers to us when downloading
|
boolean |
isAcceptAnyCertificate() |
boolean |
isCompress() |
boolean |
isOnlyIfNewer() |
boolean |
isOverwrite() |
boolean |
isQuiet() |
void |
onlyIfNewer(boolean onlyIfNewer)
Sets the onlyIfNewer flag
|
void |
overwrite(boolean overwrite)
Sets the overwrite flag
|
void |
password(java.lang.String password)
Sets the password for
Basic authentication |
void |
quiet(boolean quiet)
Sets the quiet flag
|
void |
src(java.lang.Object src)
Sets the download source URL
|
void |
username(java.lang.String username)
Sets the username for
Basic authentication |
addValidator, appendParallelSafeAction, compareTo, configure, deleteAllActions, dependsOn, dependsOnTaskDidWork, doFirst, doFirst, doLast, doLast, execute, finalizedBy, getActions, getAnt, getAsDynamicObject, getConvention, getDependsOn, getDescription, getDidWork, getEnabled, getExecuter, getExtensions, getFinalizedBy, getGroup, getImpliesSubProjects, getInputs, getLogger, getLogging, getMustRunAfter, getName, getOnlyIf, getOutputs, getPath, getProject, getServices, getShouldRunAfter, getStandardOutputCapture, getState, getTaskActions, getTaskDependencies, getTemporaryDir, getTemporaryDirFactory, getValidators, hasProperty, injectIntoNewInstance, isEnabled, isHasCustomActions, leftShift, mustRunAfter, onlyIf, onlyIf, prependParallelSafeAction, property, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setExecuter, setFinalizedBy, setGroup, setImpliesSubProjects, setMustRunAfter, setName, setOnlyIf, setOnlyIf, setProject, setProperty, setShouldRunAfter, shouldRunAfter, toStringpublic void download()
throws java.io.IOException
java.io.IOException - if the file could not downloaded@OutputFiles public java.util.List<java.io.File> getOutputFiles()
public void src(java.lang.Object src)
throws java.net.MalformedURLException
DownloadSpecsrc in interface DownloadSpecsrc - the URLjava.net.MalformedURLException - if the download source is not a URLpublic void dest(java.lang.Object dest)
DownloadSpecdest in interface DownloadSpecdest - a file or directory where to store the retrieved filepublic void quiet(boolean quiet)
DownloadSpecquiet in interface DownloadSpecquiet - true if download progress should not be loggedpublic void overwrite(boolean overwrite)
DownloadSpecoverwrite in interface DownloadSpecoverwrite - true if existing files should be overwritten, false otherwisepublic void onlyIfNewer(boolean onlyIfNewer)
DownloadSpeconlyIfNewer in interface DownloadSpeconlyIfNewer - true if the file should only be downloaded if it
has been modified on the server since the last downloadpublic void compress(boolean compress)
DownloadSpeccompress in interface DownloadSpeccompress - true if compression should be enabledpublic void username(java.lang.String username)
DownloadSpecBasic authenticationusername in interface DownloadSpecusername - the usernamepublic void password(java.lang.String password)
DownloadSpecBasic authenticationpassword in interface DownloadSpecpassword - the passwordpublic void headers(java.util.Map<java.lang.String,java.lang.String> headers)
DownloadSpecheaders in interface DownloadSpecheaders - a Map of header names to valuespublic void header(java.lang.String name,
java.lang.String value)
DownloadSpecheader in interface DownloadSpecname - name of the HTTP headervalue - value of the HTTP headerpublic void acceptAnyCertificate(boolean accept)
DownloadSpecacceptAnyCertificate in interface DownloadSpecaccept - true if certificate errors should be ignored (default: false)public java.lang.Object getSrc()
getSrc in interface DownloadSpecpublic java.io.File getDest()
getDest in interface DownloadSpecpublic boolean isQuiet()
isQuiet in interface DownloadSpecpublic boolean isOverwrite()
isOverwrite in interface DownloadSpecpublic boolean isOnlyIfNewer()
isOnlyIfNewer in interface DownloadSpecpublic boolean isCompress()
isCompress in interface DownloadSpecpublic java.lang.String getUsername()
getUsername in interface DownloadSpecBasic authenticationpublic java.lang.String getPassword()
getPassword in interface DownloadSpecBasic authenticationpublic java.util.Map<java.lang.String,java.lang.String> getHeaders()
getHeaders in interface DownloadSpecpublic java.lang.String getHeader(java.lang.String name)
getHeader in interface DownloadSpecname - name of the HTTP headerpublic boolean isAcceptAnyCertificate()
isAcceptAnyCertificate in interface DownloadSpec