Class AwsSignedChunkedEncodingInputStream
java.lang.Object
java.io.InputStream
software.amazon.awssdk.core.io.SdkInputStream
software.amazon.awssdk.core.internal.io.AwsChunkedInputStream
software.amazon.awssdk.core.internal.io.AwsChunkedEncodingInputStream
software.amazon.awssdk.auth.signer.internal.chunkedencoding.AwsSignedChunkedEncodingInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable,Releasable
@SdkInternalApi
public final class AwsSignedChunkedEncodingInputStream
extends AwsChunkedEncodingInputStream
A wrapper of InputStream that implements chunked encoding.
Each chunk will be buffered for the calculation of the chunk signature
which is added at the head of each chunk. The request signature and the chunk signatures will
be assumed to be hex-encoded strings.
This class will use the mark() & reset() of the wrapped InputStream if they
are supported, otherwise it will create a buffer for bytes read from
the wrapped stream.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from class software.amazon.awssdk.core.internal.io.AwsChunkedEncodingInputStream
calculatedChecksum, checksumHeaderForTrailer, CRLF, FINAL_CHUNK, HEADER_COLON_SEPARATOR, isTrailingTerminatedFields inherited from class software.amazon.awssdk.core.internal.io.AwsChunkedInputStream
currentChunkIterator, DEFAULT_CHUNK_SIZE, is, isAtStart, isTerminating, log, SKIP_BUFFER_SIZE, underlyingStreamBuffer -
Method Summary
Modifier and TypeMethodDescriptionbuilder()static intcalculateChecksumContentLength(Algorithm algorithm, String headerName, int signatureLength) static longcalculateStreamContentLength(long originalLength, int signatureLength, AwsChunkedEncodingConfig config) static longcalculateStreamContentLength(long originalLength, int signatureLength, AwsChunkedEncodingConfig config, boolean isTrailingChecksumCalculated) Calculates the expected total length of signed payload chunked stream.protected byte[]protected byte[]createChunk(byte[] chunkData) protected byte[]createFinalChunk(byte[] finalChunk) voidreset()Methods inherited from class software.amazon.awssdk.core.internal.io.AwsChunkedEncodingInputStream
mark, readMethods inherited from class software.amazon.awssdk.core.internal.io.AwsChunkedInputStream
getWrappedInputStream, markSupported, read, skipMethods inherited from class software.amazon.awssdk.core.io.SdkInputStream
abort, abortIfNeeded, releaseMethods inherited from class java.io.InputStream
available, close, read
-
Method Details
-
builder
-
calculateStreamContentLength
public static long calculateStreamContentLength(long originalLength, int signatureLength, AwsChunkedEncodingConfig config) -
calculateStreamContentLength
public static long calculateStreamContentLength(long originalLength, int signatureLength, AwsChunkedEncodingConfig config, boolean isTrailingChecksumCalculated) Calculates the expected total length of signed payload chunked stream.- Parameters:
originalLength- The length of the datasignatureLength- The length of a calculated signature, dependent on whichAwsChunkSigneris usedconfig- The chunked encoding config determines the size of the chunks. Use the same values as when initializing the stream.
-
createFinalChunk
protected byte[] createFinalChunk(byte[] finalChunk) - Specified by:
createFinalChunkin classAwsChunkedEncodingInputStream
-
createChunk
protected byte[] createChunk(byte[] chunkData) - Specified by:
createChunkin classAwsChunkedEncodingInputStream
-
createChecksumChunkHeader
protected byte[] createChecksumChunkHeader()- Specified by:
createChecksumChunkHeaderin classAwsChunkedEncodingInputStream
-
calculateChecksumContentLength
-
reset
- Overrides:
resetin classAwsChunkedEncodingInputStream- Throws:
IOException
-