public class AWS4SignerForChunkedUpload extends AWS4SignerBase
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
STREAMING_BODY_SHA256
SHA256 substitute marker used in place of x-amz-content-sha256 when
employing chunked uploads
|
ALGORITHM, DateStringFormat, EMPTY_BODY_SHA256, ISO8601BasicFormat, SCHEME, TERMINATOR
Constructor and Description |
---|
AWS4SignerForChunkedUpload(java.net.URL endpointUrl,
java.lang.String httpMethod,
java.lang.String serviceName,
java.lang.String regionName) |
Modifier and Type | Method and Description |
---|---|
static long |
calculateChunkedContentLength(long originalLength,
long chunkSize)
Calculates the expanded payload size of our data when it is chunked
|
java.lang.String |
computeSignature(java.util.Map<java.lang.String,java.lang.String> headers,
java.util.Map<java.lang.String,java.lang.String> queryParameters,
java.lang.String bodyHash,
java.lang.String awsAccessKey,
java.lang.String awsSecretKey)
Computes an AWS4 signature for a request, ready for inclusion as an
'Authorization' header.
|
byte[] |
constructSignedChunk(int userDataLen,
byte[] userData)
Returns a chunk for upload consisting of the signed 'header' or chunk
prefix plus the user data.
|
getCanonicalizedQueryString, hash, hash
public static final java.lang.String STREAMING_BODY_SHA256
public AWS4SignerForChunkedUpload(java.net.URL endpointUrl, java.lang.String httpMethod, java.lang.String serviceName, java.lang.String regionName)
public java.lang.String computeSignature(java.util.Map<java.lang.String,java.lang.String> headers, java.util.Map<java.lang.String,java.lang.String> queryParameters, java.lang.String bodyHash, java.lang.String awsAccessKey, java.lang.String awsSecretKey)
headers
- The request headers; 'Host' and 'X-Amz-Date' will be added to
this set.queryParameters
- Any query parameters that will be added to the endpoint. The
parameters should be specified in canonical format.bodyHash
- Precomputed SHA256 hash of the request body content; this
value should also be set as the header 'X-Amz-Content-SHA256'
for non-streaming uploads.awsAccessKey
- The user's AWS Access Key.awsSecretKey
- The user's AWS Secret Key.public static long calculateChunkedContentLength(long originalLength, long chunkSize)
originalLength
- The true size of the data payload to be uploadedchunkSize
- The size of each chunk we intend to send; each chunk will be
prefixed with signed header data, expanding the overall size
by a determinable amountpublic byte[] constructSignedChunk(int userDataLen, byte[] userData)
userDataLen
- The length of the user data contained in userDatauserData
- Contains the user data to be sent in the upload chunk