Package org.apache.tika.digest
Interface Digester
- All Known Implementing Classes:
BouncyCastleDigester,CommonsDigester,CompositeDigester,InputStreamDigester
public interface Digester
Interface for digester implementations.
See
InputStreamDigester for an implementation
in tika-core, or CommonsDigester in tika-parser-digest-commons.-
Method Summary
Modifier and TypeMethodDescriptionvoiddigest(TikaInputStream tis, Metadata m, ParseContext parseContext) Digests a TikaInputStream and sets the appropriate value(s) in the metadata.default DigestSinkdigestSink(Metadata m, ParseContext parseContext) A sink that digests whatever is written to it and sets the value(s) in the metadata when committed and closed.
-
Method Details
-
digest
Digests a TikaInputStream and sets the appropriate value(s) in the metadata. The Digester is responsible for callingTikaInputStream.enableRewind()andTikaInputStream.rewind()to ensure the stream can be read by subsequent processing after digesting.The stream must not be closed by the digester.
- Parameters:
tis- TikaInputStream to digestm- Metadata to set the values forparseContext- ParseContext- Throws:
IOException- on I/O error
-
digestSink
A sink that digests whatever is written to it and sets the value(s) in the metadata when committed and closed. For producers that only write (an embedded-stream translator, say) this digests the bytes as they are produced, with no buffer and no temp file. SeeDigestSinkfor the commit/close contract.The default buffers what is written -- in memory below a fixed threshold, in a temp file above it -- and runs
digest(org.apache.tika.io.TikaInputStream, org.apache.tika.metadata.Metadata, org.apache.tika.parser.ParseContext)over it when committed, so one that only overridesdigestkeeps working unchanged. It does not get the streaming behaviour: override this method to provide it.- Parameters:
m- Metadata the values are set on when the sink is committedparseContext- ParseContext- Returns:
- a sink; the caller must close it, and the values are set only if it was committed
- Throws:
IOException
-