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 aCrc32ChecksumCalculatingInputStream
and 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 void
close()
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 IOException
Closes the underlying stream and validates the calculated checksum against the expected.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classSdkFilterInputStream
- Throws:
Crc32MismatchException
- If the calculated CRC32 checksum does not match the expected.IOException
-
-