Package org.apache.tools.ant.types.selectors.modifiedselector

## Class ChecksumAlgorithm

- java.lang.Object
- - org.apache.tools.ant.types.selectors.modifiedselector.ChecksumAlgorithm

- All Implemented Interfaces:
    `Algorithm`

      public class ChecksumAlgorithm
      extends java.lang.Object
      implements Algorithm

  Computes a 'checksum' for the content of file using java.util.zip.CRC32 and java.util.zip.Adler32. Use of this algorithm doesn't require any additional nested <param>s. Supported <param>s are:

  Checksum algorithm parameters
  name | values | description | required
  --- | --- | --- | ---
  algorithm.algorithm | ADLER | CRC (default) | name of the algorithm the checksum should use | no, defaults to CRC

  Since:
    Ant 1.7
  Version:
    2004-06-17

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `ChecksumAlgorithm()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `java.lang.String` | `getValue​(java.io.File file)` | Computes a value for a file content with the specified checksum algorithm.
    `void` | `initChecksum()` | Initialize the checksum interface.
    `boolean` | `isValid()` | This algorithm supports only CRC and Adler.
    `void` | `setAlgorithm​(java.lang.String algorithm)` | Specifies the algorithm to be used to compute 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

    - #### ChecksumAlgorithm

          public ChecksumAlgorithm()

  - ### Method Detail

    - #### setAlgorithm

          public void setAlgorithm​(java.lang.String algorithm)

      Specifies the algorithm to be used to compute the checksum. Defaults to "CRC". Other popular algorithms like "ADLER" may be used as well.
      Parameters:
        `algorithm` - the digest algorithm to use

    - #### initChecksum

          public void initChecksum()

      Initialize the checksum interface.

    - #### isValid

          public boolean isValid()

      This algorithm supports only CRC and Adler.
      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 checksum 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.