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
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 Modifier and Type Class Description static classAwsSignedChunkedEncodingInputStream.Builder
-
Field Summary
-
Fields inherited from class software.amazon.awssdk.core.internal.io.AwsChunkedEncodingInputStream
calculatedChecksum, checksumHeaderForTrailer, CRLF, FINAL_CHUNK, HEADER_COLON_SEPARATOR, isTrailingTerminated
-
Fields inherited from class software.amazon.awssdk.core.internal.io.AwsChunkedInputStream
currentChunkIterator, DEFAULT_CHUNK_SIZE, is, isAtStart, isTerminating, log, SKIP_BUFFER_SIZE, underlyingStreamBuffer
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static AwsSignedChunkedEncodingInputStream.Builderbuilder()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[]createChecksumChunkHeader()protected byte[]createChunk(byte[] chunkData)protected byte[]createFinalChunk(byte[] finalChunk)voidreset()-
Methods inherited from class software.amazon.awssdk.core.internal.io.AwsChunkedEncodingInputStream
mark, read
-
Methods inherited from class software.amazon.awssdk.core.internal.io.AwsChunkedInputStream
getWrappedInputStream, markSupported, read, skip
-
Methods inherited from class software.amazon.awssdk.core.io.SdkInputStream
abort, abortIfNeeded, release
-
Methods inherited from class java.io.InputStream
available, close, read
-
-
-
-
Method Detail
-
builder
public static AwsSignedChunkedEncodingInputStream.Builder 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
public static int calculateChecksumContentLength(Algorithm algorithm, String headerName, int signatureLength)
-
reset
public void reset() throws IOException- Overrides:
resetin classAwsChunkedEncodingInputStream- Throws:
IOException
-
-