Class Crc32ChecksumValidatingInputStream
- java.lang.Object
-
- java.io.InputStream
-
- java.io.FilterInputStream
-
- software.amazon.awssdk.core.io.SdkFilterInputStream
-
- software.amazon.awssdk.core.internal.util.Crc32ChecksumValidatingInputStream
-
- All Implemented Interfaces:
Closeable,AutoCloseable,Releasable
public class Crc32ChecksumValidatingInputStream extends SdkFilterInputStream
Wraps the provided input stream with aCrc32ChecksumCalculatingInputStreamand after the stream is closed will validate the calculated checksum against the actual checksum.
-
-
Field Summary
-
Fields inherited from class java.io.FilterInputStream
in
-
-
Constructor Summary
Constructors Constructor Description Crc32ChecksumValidatingInputStream(InputStream in, long expectedChecksum)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the underlying stream and validates the calculated checksum against the expected.-
Methods inherited from class software.amazon.awssdk.core.io.SdkFilterInputStream
abort, abortIfNeeded, available, mark, markSupported, read, read, release, reset, skip
-
Methods inherited from class java.io.FilterInputStream
read
-
-
-
-
Constructor Detail
-
Crc32ChecksumValidatingInputStream
public Crc32ChecksumValidatingInputStream(InputStream in, long expectedChecksum)
- Parameters:
in- Input stream to content.expectedChecksum- Expected CRC32 checksum returned by the service.
-
-
Method Detail
-
close
public void close() throws IOExceptionCloses the underlying stream and validates the calculated checksum against the expected.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classSdkFilterInputStream- Throws:
Crc32MismatchException- If the calculated CRC32 checksum does not match the expected.IOException
-
-