de.undercouch.gradle.tasks.download
Class Verify

java.lang.Object
  extended by org.gradle.api.internal.AbstractTask
      extended by org.gradle.api.DefaultTask
          extended by de.undercouch.gradle.tasks.download.Verify
All Implemented Interfaces:
VerifySpec, 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 Verify
extends org.gradle.api.DefaultTask
implements VerifySpec

Verifies a file's integrity by calculating its checksum.

 task verifyFile(type: Verify) {
     file new File(buildDir, "myfile.txt")
     algorithm 'MD5'
     checksum '694B2863621FCDBBBA2777BF329C056C' // expected checksum (hex)
 }
 


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
Verify()
          Default constructor
 
Method Summary
 void algorithm(java.lang.String algorithm)
          Set the algorithm to use to compute the checksum.
 void checksum(java.lang.String checksum)
          Set the actual checksum to verify against
 java.lang.String getAlgorithm()
           
 java.lang.String getChecksum()
           
 java.io.File getSrc()
           
 void src(java.lang.Object src)
          Sets the file to verify
 void verify()
          Starts verifying
 
Methods inherited from class org.gradle.api.internal.AbstractTask
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, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Verify

public Verify()
Default constructor

Method Detail

verify

public void verify()
            throws java.io.IOException,
                   java.security.NoSuchAlgorithmException
Starts verifying

Throws:
java.io.IOException - if the file could not be verified
java.security.NoSuchAlgorithmException - if the given algorithm is not available

src

public void src(java.lang.Object src)
Description copied from interface: VerifySpec
Sets the file to verify

Specified by:
src in interface VerifySpec
Parameters:
src - the file (either a filename or a File object)

algorithm

public void algorithm(java.lang.String algorithm)
Description copied from interface: VerifySpec
Set the algorithm to use to compute the checksum. Defaults to "MD5" (see the list of algorithm names for more information).

Specified by:
algorithm in interface VerifySpec
Parameters:
algorithm - the name of the algorithm

checksum

public void checksum(java.lang.String checksum)
Description copied from interface: VerifySpec
Set the actual checksum to verify against

Specified by:
checksum in interface VerifySpec
Parameters:
checksum - the checksum (in hex)

getSrc

public java.io.File getSrc()
Specified by:
getSrc in interface VerifySpec
Returns:
the file to verify

getAlgorithm

public java.lang.String getAlgorithm()
Specified by:
getAlgorithm in interface VerifySpec
Returns:
the algorithm to use to compute the checksum

getChecksum

public java.lang.String getChecksum()
Specified by:
getChecksum in interface VerifySpec
Returns:
the actual checksum to verify against (in hex)