public class CommonsDigester extends Object implements DigestingParser.Digester
DigestingParser.Digesterthat 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.
If a TikaInputStream is passed in and it has an underlying file that is longer
markLimit, then this digester digests the file directly.
|Modifier and Type||Class and Description|
|Constructor and Description|
|Modifier and Type||Method and Description|
Digests an InputStream and sets the appropriate value(s) in the metadata.
public CommonsDigester(int markLimit, CommonsDigester.DigestAlgorithm... algorithms)
public void digest(InputStream is, Metadata m, ParseContext parseContext) throws IOException
The given stream is guaranteed to support the
mark feature and the detector
is expected to
mark the stream before
reading any bytes from it, and to
the stream before returning. The stream must not be closed by the
Copyright © 2007–2016 The Apache Software Foundation. All rights reserved.