Class CommonsDigester

  • All Implemented Interfaces:
    DigestingParser.Digester

    public class CommonsDigester
    extends CompositeDigester
    Implementation of DigestingParser.Digester that relies on commons.codec.digest.DigestUtils to calculate digest hashes.

    This digester tries to use the regular mark/reset protocol on the InputStream. However, this wraps an internal BoundedInputStream, and if the InputStream is not fully read, then this will reset the stream and spool the InputStream to disk (via TikaInputStream) and then digest the file.

    • Constructor Detail

      • CommonsDigester

        public CommonsDigester​(int markLimit,
                               String algorithmString)
        Include a string representing the comma-separated algorithms to run: e.g. "md5,sha1". If you want base 32 encoding instead of hexadecimal, add ":32" to the algorithm, e.g. "md5,sha1:32"

        Will throw an IllegalArgumentException if an algorithm isn't supported

        Parameters:
        markLimit -
        algorithmString -
      • CommonsDigester

        public CommonsDigester​(int markLimit,
                               CommonsDigester.DigestAlgorithm... algorithms)
        Parameters:
        markLimit - limit for mark/reset; after this limit is hit, the stream is reset and spooled to disk
        algorithms - algorithms to run