Class ChecksumInputStream

All Implemented Interfaces:
Closeable, AutoCloseable

public final class ChecksumInputStream extends CountingInputStream
Automatically verifies a Checksum value once the stream is exhausted or the count threshold is reached.

If the Checksum does not meet the expected value when exhausted, then the input stream throws an IOException.

If you do not need the verification or threshold feature, then use a plain CheckedInputStream.

To build an instance, use ChecksumInputStream.Builder.

Since:
2.16.0
See Also:
  • Field Details

    • expectedChecksumValue

      private final long expectedChecksumValue
      The expected checksum.
    • countThreshold

      private final long countThreshold
      The count threshold to limit how much input is consumed to update the Checksum before the input stream validates its value.

      By default, all input updates the Checksum.

  • Constructor Details

  • Method Details