Skip to content

Commit

Permalink
Add more javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
haydenbaker committed Aug 31, 2023
1 parent e6885b2 commit 9de4aef
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
import java.util.zip.Checksum;
import software.amazon.awssdk.annotations.SdkInternalApi;

/**
* An input-stream that takes a collection of checksums, and updates each checksum when it reads data.
*/
@SdkInternalApi
public class ChecksumInputStream extends FilterInputStream {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
import org.reactivestreams.Subscription;
import software.amazon.awssdk.annotations.SdkInternalApi;

/**
* A subscriber that takes a collection of checksums, and updates each checksum when it receives data.
*/
@SdkInternalApi
public final class ChecksumSubscriber implements Subscriber<ByteBuffer> {
private final CompletableFuture<Void> checksumming = new CompletableFuture<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@
import software.amazon.awssdk.http.auth.aws.signer.Checksummer;

/**
* A "flexible" implementation of a checksummer.
* A "flexible" implementation of a checksummer. It takes a map of checksums and their header names, computes them efficiently
* by updating each checksum while reading the payload (once), and adds the computed checksum strings to the request using the
* given header names in the map. This should be used in cases where a (flexible) checksum algorithm is present during signing.
*/
@SdkInternalApi
public final class FlexibleChecksummer implements Checksummer {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@

/**
* An implementation of a checksummer that simply passes along a computed value as a checksum. Specifically, this is used in
* the cases where the checksum is a pre-defined value that dictates specific behavior by the signer (such as aws-chunked
* payload signing, unsigned streaming with trailers, etc.).
* the cases where the checksum is a pre-defined value that dictates specific behavior by the signer, and flexible checksums is
* not enabled for the request (such as aws-chunked payload signing without trailers, unsigned streaming without trailers, etc.).
*/
@SdkInternalApi
public final class PrecomputedChecksummer implements Checksummer {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ static Checksummer create() {
}

/**
* Get a flexible checksummer that uses the given checksum-algorithm and the default.
* Get a flexible checksummer that performs two checksums: the given checksum-algorithm and the default (sha256).
*/
static Checksummer create(ChecksumAlgorithm checksumAlgorithm) {
if (checksumAlgorithm != null) {
Expand All @@ -63,14 +63,15 @@ static Checksummer create(ChecksumAlgorithm checksumAlgorithm) {
}

/**
* Get a flexible checksummer that uses the given checksum-algorithm and the default.
* Get a precomputed checksummer that results the given checksum string.
*/
static Checksummer create(String checksum) {
return new PrecomputedChecksummer(() -> checksum);
}

/**
* Get a flexible checksummer that uses the given checksum-algorithm and the default.
* Get a flexible checksummer that performs two checksums: the given checksum-algorithm and a precomputed checksum from the
* given checksum string.
*/
static Checksummer create(String checksum, ChecksumAlgorithm checksumAlgorithm) {
if (checksumAlgorithm != null) {
Expand Down

0 comments on commit 9de4aef

Please sign in to comment.