Class CommonsDigesterFactory

java.lang.Object
org.apache.tika.parser.digestutils.CommonsDigesterFactory
All Implemented Interfaces:
DigesterFactory

public class CommonsDigesterFactory extends Object implements DigesterFactory
Factory for CommonsDigester with configurable algorithms and encodings.

Default: MD5 with HEX encoding.

Example JSON configuration (in parse-context section):

 {
   "parse-context": {
     "digester-factory": {
       "commons-digester-factory": {
         "digests": [
           { "algorithm": "MD5" },
           { "algorithm": "SHA256", "encoding": "BASE32" }
         ],
         "skipContainerDocumentDigest": false
       }
     }
   }
 }
 
  • Constructor Details

    • CommonsDigesterFactory

      public CommonsDigesterFactory()
  • Method Details

    • build

      public Digester build()
      Description copied from interface: DigesterFactory
      Build a new Digester instance using the factory's configured properties.
      Specified by:
      build in interface DigesterFactory
      Returns:
      a new Digester instance
    • isSkipContainerDocumentDigest

      public boolean isSkipContainerDocumentDigest()
      Description copied from interface: DigesterFactory
      Returns whether to skip digesting for container (top-level) documents. When true, only embedded documents (depth > 0) will be digested.

      Default implementation returns false (digest everything).

      Specified by:
      isSkipContainerDocumentDigest in interface DigesterFactory
      Returns:
      true if container documents should be skipped, false otherwise
    • setSkipContainerDocumentDigest

      public void setSkipContainerDocumentDigest(boolean skipContainerDocumentDigest)
    • getDigests

      public List<DigestDef> getDigests()
    • setDigests

      public void setDigests(List<DigestDef> digests)