public final class AwsChunkedEncodingInputStream extends SdkInputStream
Constructor and Description |
---|
AwsChunkedEncodingInputStream(InputStream in,
String headerSignature,
AwsChunkSigner chunkSigner,
AwsChunkedEncodingConfig config)
Creates a chunked encoding input stream initialized with the originating stream, an http request seed signature
and a signer that can sign a chunk of bytes according to a chosen algorithm.
|
Modifier and Type | Method and Description |
---|---|
static long |
calculateStreamContentLength(long originalLength,
int signatureLength,
AwsChunkedEncodingConfig config)
Calculates the expected total length of signed payload chunked stream.
|
protected InputStream |
getWrappedInputStream() |
void |
mark(int readlimit)
The readlimit parameter is ignored.
|
boolean |
markSupported() |
int |
read() |
int |
read(byte[] b,
int off,
int len) |
void |
reset()
Reset the stream, either by resetting the wrapped stream or using the
buffer created by this class.
|
long |
skip(long n) |
abort, abortIfNeeded, release
available, close, read
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
release
public AwsChunkedEncodingInputStream(InputStream in, String headerSignature, AwsChunkSigner chunkSigner, AwsChunkedEncodingConfig config)
calculateStreamContentLength(long, int, AwsChunkedEncodingConfig)
.in
- The original InputStream.headerSignature
- The signature of the signed headers of the request. This will be used for
calculating the signature of the first chunk. Observe that the format of
this parameter should be a hex-encoded string.chunkSigner
- The signer for each chunk of data, implementing the AwsChunkSigner
interface.config
- The configuration allows the user to customize chunk size and buffer size.
See AwsChunkedEncodingConfig
for default values.public int read() throws IOException
read
in class InputStream
IOException
public int read(byte[] b, int off, int len) throws IOException
read
in class InputStream
IOException
public long skip(long n) throws IOException
skip
in class InputStream
IOException
public boolean markSupported()
markSupported
in class InputStream
InputStream.markSupported()
public void mark(int readlimit)
mark
in class InputStream
public void reset() throws IOException
reset
in class InputStream
IOException
public static long calculateStreamContentLength(long originalLength, int signatureLength, AwsChunkedEncodingConfig config)
originalLength
- The length of the datasignatureLength
- The length of a calculated signature, dependent on which AwsChunkSigner
is usedconfig
- The chunked encoding config determines the size of the chunks. Use the same values as when
initializing the stream
AwsChunkedEncodingInputStream(InputStream, String, AwsChunkSigner, AwsChunkedEncodingConfig)
.protected InputStream getWrappedInputStream()
getWrappedInputStream
in class SdkInputStream
Copyright © 2021. All rights reserved.