Interface Checksummer
- All Known Implementing Classes:
FlexibleChecksummer
,PrecomputedSha256Checksummer
public interface Checksummer
An interface for defining how a checksum is formed from a payload synchronously and asynchronously.
The implementation may choose to also manipulate the request with the checksum, such as adding it as a header. Note: Currently, checksummers set the X_AMZ_CONTENT_SHA256 header for all requests. It is not strictly required to add the headers to all AWS requests - it's required for S3 and a couple of other select use cases. The pre-SRA implementation has a stricter set of rules for when to add the header. Being more restrictive with adding the header would require restructuring the signer / checksummer design.
-
Method Summary
Modifier and TypeMethodDescriptionCompletableFuture
<org.reactivestreams.Publisher<ByteBuffer>> checksum
(org.reactivestreams.Publisher<ByteBuffer> payload, SdkHttpRequest.Builder request) Given a payload, asynchronously calculate a checksum and promise to add it to the request.void
checksum
(ContentStreamProvider payload, SdkHttpRequest.Builder request) Given a payload, calculate a checksum and add it to the request.static Checksummer
create()
Get a default implementation of a checksummer, which calculates the SHA-256 checksum and places it in the x-amz-content-sha256 header.static Checksummer
forFlexibleChecksum
(String precomputedSha256, ChecksumAlgorithm checksumAlgorithm) Get a flexible checksummer that performs two checksums: the given checksum-algorithm and a precomputed checksum from the given checksum string.static Checksummer
forFlexibleChecksum
(ChecksumAlgorithm checksumAlgorithm) Get a flexible checksummer that performs two checksums: the given checksum-algorithm and the SHA-256 checksum.static Checksummer
forNoOp()
static Checksummer
forPrecomputed256Checksum
(String precomputedSha256) Get a precomputed checksummer which places the precomputed checksum to the x-amz-content-sha256 header.
-
Method Details
-
create
Get a default implementation of a checksummer, which calculates the SHA-256 checksum and places it in the x-amz-content-sha256 header. -
forFlexibleChecksum
Get a flexible checksummer that performs two checksums: the given checksum-algorithm and the SHA-256 checksum. It places the SHA-256 checksum in x-amz-content-sha256 header, and the given checksum-algorithm in the x-amz-checksum-[name] header. -
forPrecomputed256Checksum
Get a precomputed checksummer which places the precomputed checksum to the x-amz-content-sha256 header. -
forFlexibleChecksum
static Checksummer forFlexibleChecksum(String precomputedSha256, ChecksumAlgorithm checksumAlgorithm) Get a flexible checksummer that performs two checksums: the given checksum-algorithm and a precomputed checksum from the given checksum string. It places the precomputed checksum in x-amz-content-sha256 header, and the given checksum-algorithm in the x-amz-checksum-[name] header. -
forNoOp
-
checksum
Given a payload, calculate a checksum and add it to the request. -
checksum
CompletableFuture<org.reactivestreams.Publisher<ByteBuffer>> checksum(org.reactivestreams.Publisher<ByteBuffer> payload, SdkHttpRequest.Builder request) Given a payload, asynchronously calculate a checksum and promise to add it to the request.
-