Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.tools.ant.types.selectors.modifiedselector
Class DigestAlgorithm

    java.lang.Object
      |
      +--org.apache.tools.ant.types.selectors.modifiedselector.DigestAlgorithm

All Implemented Interfaces:
  Algorithm

public class DigestAlgorithm
extends java.lang.Object
implements Algorithm

Computes a 'hashvalue' for the content of file using java.security.MessageDigest. Use of this algorithm doesn't require any additional nested s. Supported s are:

name | values | description | required
--- | --- | --- | ---
algorithm.algorithm | MD5 | SHA (default provider) | name of the algorithm the provider should use | no, defaults to MD5
algorithm.provider |  | name of the provider to use | no, defaults to null

Since:
  Ant 1.6
Version:
  2003-09-13

Constructor Summary
`DigestAlgorithm()`

Method Summary
`java.lang.String` | `getValue(java.io.File file)` Computes a value for a file content with the specified digest algorithm.
`void` | `initMessageDigest()` Initialize the security message digest.
`boolean` | `isValid()` This algorithm doesn't need any configuration.
`void` | `setAlgorithm(java.lang.String algorithm)` Specifies the algorithm to be used to compute the checksum.
`void` | `setProvider(java.lang.String provider)` Sets the MessageDigest algorithm provider to be used to calculate the checksum.
`java.lang.String` | `toString()` Override Object.toString().

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### DigestAlgorithm

    public DigestAlgorithm()

Method Detail

### setAlgorithm

    public void setAlgorithm(java.lang.String algorithm)

  Specifies the algorithm to be used to compute the checksum. Defaults to "MD5". Other popular algorithms like "SHA" may be used as well.

  Parameters:
    `algorithm` - the digest algorithm to use

### setProvider

    public void setProvider(java.lang.String provider)

  Sets the MessageDigest algorithm provider to be used to calculate the checksum.

  Parameters:
    `provider` - provider to use

### initMessageDigest

    public void initMessageDigest()

  Initialize the security message digest.

### isValid

    public boolean isValid()

  This algorithm doesn't need any configuration. Therefore it's always valid.

  Specified by:
    `isValid` in interface `Algorithm`
  Returns:
    true if all is ok, otherwise false.

### getValue

    public java.lang.String getValue(java.io.File file)

  Computes a value for a file content with the specified digest algorithm.

  Specified by:
    `getValue` in interface `Algorithm`
  Parameters:
    `file` - File object for which the value should be evaluated.
  Returns:
    The value for that file

### toString

    public java.lang.String toString()

  Override Object.toString().

  Overrides:
    `toString` in class `java.lang.Object`
  Returns:
    some information about this algorithm.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2005 Apache Software Foundation. All Rights Reserved.