ChecksumVerifyingInputStream
Date: 2017-02-08

org.apache.commons.compress.utils

## Class ChecksumVerifyingInputStream

- java.lang.Object
- - java.io.InputStream
  - - org.apache.commons.compress.utils.ChecksumVerifyingInputStream

- All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable
  Direct Known Subclasses:
    CRC32VerifyingInputStream

      public class ChecksumVerifyingInputStream
      extends java.io.InputStream

  A stream that verifies the checksum of the data read once the stream is exhausted.
  Since:
    1.7

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ChecksumVerifyingInputStream(java.util.zip.Checksum checksum, java.io.InputStream in, long size, long expectedChecksum)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()`
    `int` | `read()` Reads a single byte from the stream
    `int` | `read(byte[] b)` Reads a byte array from the stream
    `int` | `read(byte[] b, int off, int len)` Reads from the stream into a byte array.
    `long` | `skip(long n)`

    - ### Methods inherited from class java.io.InputStream

      `available, mark, markSupported, reset`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ChecksumVerifyingInputStream

          public ChecksumVerifyingInputStream(java.util.zip.Checksum checksum,
                                      java.io.InputStream in,
                                      long size,
                                      long expectedChecksum)

  - ### Method Detail

    - #### read

          public int read()
                   throws java.io.IOException

      Reads a single byte from the stream
      Specified by:
        `read` in class `java.io.InputStream`
      Throws:
        `java.io.IOException` - if the underlying stream throws or the stream is exhausted and the Checksum doesn't match the expected value

    - #### read

          public int read(byte[] b)
                   throws java.io.IOException

      Reads a byte array from the stream
      Overrides:
        `read` in class `java.io.InputStream`
      Throws:
        `java.io.IOException` - if the underlying stream throws or the stream is exhausted and the Checksum doesn't match the expected value

    - #### read

          public int read(byte[] b,
                 int off,
                 int len)
                   throws java.io.IOException

      Reads from the stream into a byte array.
      Overrides:
        `read` in class `java.io.InputStream`
      Throws:
        `java.io.IOException` - if the underlying stream throws or the stream is exhausted and the Checksum doesn't match the expected value

    - #### skip

          public long skip(long n)
                    throws java.io.IOException

      Overrides:
        `skip` in class `java.io.InputStream`
      Throws:
        `java.io.IOException`

    - #### close

          public void close()
                     throws java.io.IOException

      Specified by:
        `close` in interface `java.io.Closeable`
      Specified by:
        `close` in interface `java.lang.AutoCloseable`
      Overrides:
        `close` in class `java.io.InputStream`
      Throws:
        `java.io.IOException`