Class DigestDef

java.lang.Object
org.apache.tika.digest.DigestDef

public class DigestDef extends Object
Defines a digest algorithm with its output encoding.

Example JSON configuration:

 {
   "digests": [
     { "algorithm": "MD5" },
     { "algorithm": "SHA256", "encoding": "BASE32" }
   ]
 }
 

The metadata key format is:

  • X-TIKA:digest:MD5 - for HEX encoding (default)
  • X-TIKA:digest:SHA256:BASE32 - for non-default encodings
  • Constructor Details

  • Method Details

    • getAlgorithm

      public DigestDef.Algorithm getAlgorithm()
    • setAlgorithm

      public void setAlgorithm(DigestDef.Algorithm algorithm)
    • getEncoding

      public DigestDef.Encoding getEncoding()
    • setEncoding

      public void setEncoding(DigestDef.Encoding encoding)
    • metadataKey

      public String metadataKey()
      Returns the metadata key for storing this digest value.

      For HEX encoding (the default), returns X-TIKA:digest:ALGORITHM. For other encodings, returns X-TIKA:digest:ALGORITHM:ENCODING.

      Returns:
      the metadata key