de.undercouch.gradle.tasks.download
Class Download

java.lang.Object
  extended by org.gradle.api.internal.AbstractTask
      extended by org.gradle.api.DefaultTask
          extended by de.undercouch.gradle.tasks.download.Download
All Implemented Interfaces:
DownloadSpec, java.lang.Comparable<org.gradle.api.Task>, org.gradle.api.internal.DynamicObjectAware, org.gradle.api.internal.TaskInternal, org.gradle.api.plugins.ExtensionAware, org.gradle.api.Task, org.gradle.util.Configurable<org.gradle.api.Task>

public class Download
extends org.gradle.api.DefaultTask
implements DownloadSpec

Downloads a file and displays progress. Example:

 task downloadFile(type: Download) {
     src 'http://www.example.com/file.ext'
     dest buildDir
 }
 


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.gradle.api.Task
org.gradle.api.Task.Namer
 
Field Summary
 
Fields inherited from interface org.gradle.api.Task
TASK_ACTION, TASK_DEPENDS_ON, TASK_DESCRIPTION, TASK_GROUP, TASK_NAME, TASK_OVERWRITE, TASK_TYPE
 
Constructor Summary
Download()
           
 
Method Summary
 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 getPassword()
           
 java.net.URL getSrc()
           
 java.lang.String getUsername()
           
 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
 
Methods inherited from class org.gradle.api.internal.AbstractTask
addValidator, compareTo, configure, deleteAllActions, dependsOn, dependsOnTaskDidWork, doFirst, doFirst, doLast, doLast, execute, executeWithoutThrowingTaskFailure, finalizedBy, getActions, getAnt, getAsDynamicObject, getConvention, getDependsOn, getDescription, getDidWork, getEnabled, getExecuter, getExtensions, getFinalizedBy, getGroup, getInputs, getLogger, getLogging, getMustRunAfter, getName, getOnlyIf, getOutputs, getPath, getProject, getServices, getStandardOutputCapture, getState, getStateInternal, getTaskActions, getTaskDependencies, getTemporaryDir, getTemporaryDirFactory, getValidators, hasProperty, injectIntoNewInstance, isEnabled, leftShift, mustRunAfter, onlyIf, onlyIf, property, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setExecuter, setFinalizedBy, setGroup, setMustRunAfter, setName, setOnlyIf, setOnlyIf, setProject, setProperty, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Download

public Download()
Method Detail

download

public void download()
              throws java.io.IOException
Starts downloading

Throws:
java.io.IOException - if the file could not downloaded

src

public void src(java.lang.Object src)
         throws java.net.MalformedURLException
Description copied from interface: DownloadSpec
Sets the download source URL

Specified by:
src in interface DownloadSpec
Parameters:
src - the URL
Throws:
java.net.MalformedURLException - if the download source is not a URL

dest

public void dest(java.lang.Object dest)
Description copied from interface: DownloadSpec
Sets the download destination

Specified by:
dest in interface DownloadSpec
Parameters:
dest - a file or directory where to store the retrieved file

quiet

public void quiet(boolean quiet)
Description copied from interface: DownloadSpec
Sets the quiet flag

Specified by:
quiet in interface DownloadSpec
Parameters:
quiet - true if download progress should not be logged

overwrite

public void overwrite(boolean overwrite)
Description copied from interface: DownloadSpec
Sets the overwrite flag

Specified by:
overwrite in interface DownloadSpec
Parameters:
overwrite - true if existing files should be overwritten, false otherwise

onlyIfNewer

public void onlyIfNewer(boolean onlyIfNewer)
Description copied from interface: DownloadSpec
Sets the onlyIfNewer flag

Specified by:
onlyIfNewer in interface DownloadSpec
Parameters:
onlyIfNewer - true if the file should only be downloaded if it has been modified on the server since the last download

compress

public void compress(boolean compress)
Description copied from interface: DownloadSpec
Specifies if compression should be used during download

Specified by:
compress in interface DownloadSpec
Parameters:
compress - true if compression should be enabled

username

public void username(java.lang.String username)
Description copied from interface: DownloadSpec
Sets the username for Basic authentication

Specified by:
username in interface DownloadSpec
Parameters:
username - the username

password

public void password(java.lang.String password)
Description copied from interface: DownloadSpec
Sets the password for Basic authentication

Specified by:
password in interface DownloadSpec
Parameters:
password - the password

getSrc

public java.net.URL getSrc()
Specified by:
getSrc in interface DownloadSpec
Returns:
the download source

getDest

public java.io.File getDest()
Specified by:
getDest in interface DownloadSpec
Returns:
the download destination

isQuiet

public boolean isQuiet()
Specified by:
isQuiet in interface DownloadSpec
Returns:
the quiet flag

isOverwrite

public boolean isOverwrite()
Specified by:
isOverwrite in interface DownloadSpec
Returns:
the overwrite flag

isOnlyIfNewer

public boolean isOnlyIfNewer()
Specified by:
isOnlyIfNewer in interface DownloadSpec
Returns:
the onlyIfNewer flag

isCompress

public boolean isCompress()
Specified by:
isCompress in interface DownloadSpec
Returns:
true if compression is enabled

getUsername

public java.lang.String getUsername()
Specified by:
getUsername in interface DownloadSpec
Returns:
the username for Basic authentication

getPassword

public java.lang.String getPassword()
Specified by:
getPassword in interface DownloadSpec
Returns:
the password for Basic authentication