Class ChecksumCalculatingInputStream
java.lang.Object
java.io.InputStream
org.apache.commons.compress.utils.ChecksumCalculatingInputStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
A stream that calculates the checksum of the data read.
- Since:
- 1.14
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.io.InputStream
available, close, mark, markSupported, readAllBytes, readNBytes, reset, transferTo
-
Field Details
-
in
-
checksum
-
-
Constructor Details
-
ChecksumCalculatingInputStream
-
-
Method Details
-
read
Reads a single byte from the stream- Specified by:
read
in classInputStream
- Throws:
IOException
- if the underlying stream throws or the stream is exhausted and the Checksum doesn't match the expected value
-
read
Reads a byte array from the stream- Overrides:
read
in classInputStream
- Throws:
IOException
- if the underlying stream throws or the stream is exhausted and the Checksum doesn't match the expected value
-
read
Reads from the stream into a byte array.- Overrides:
read
in classInputStream
- Throws:
IOException
- if the underlying stream throws or the stream is exhausted and the Checksum doesn't match the expected value
-
skip
- Overrides:
skip
in classInputStream
- Throws:
IOException
-
getValue
public long getValue()Returns the calculated checksum.- Returns:
- the calculated checksum.
-