Class ChunkContentUtils
- java.lang.Object
-
- software.amazon.awssdk.core.internal.util.ChunkContentUtils
-
public final class ChunkContentUtils extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static String
CRLF
static String
HEADER_COLON_SEPARATOR
static String
LAST_CHUNK
static long
LAST_CHUNK_LEN
static String
ZERO_BYTE
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static long
calculateChecksumTrailerLength(Algorithm algorithm, String headerName)
Calculates the content length for a given algorithm and header name.static long
calculateChunkLength(long originalContentLength)
The chunk format is: chunk-size CRLF chunk-data CRLF.static long
calculateStreamContentLength(long originalLength, long chunkSize)
Calculates the content length for data that is divided into chunks.static ByteBuffer
createChecksumTrailer(String computedChecksum, String trailerHeader)
Creates Chunk encoded checksum trailer for a computedChecksum which is in Base64 encoded.static ByteBuffer
createChunk(ByteBuffer chunkData, boolean isLastByte)
Creates ChunkEncoded data for an given chunk data.
-
-
-
Field Detail
-
HEADER_COLON_SEPARATOR
public static final String HEADER_COLON_SEPARATOR
- See Also:
- Constant Field Values
-
ZERO_BYTE
public static final String ZERO_BYTE
- See Also:
- Constant Field Values
-
CRLF
public static final String CRLF
- See Also:
- Constant Field Values
-
LAST_CHUNK
public static final String LAST_CHUNK
- See Also:
- Constant Field Values
-
LAST_CHUNK_LEN
public static final long LAST_CHUNK_LEN
-
-
Method Detail
-
calculateChunkLength
public static long calculateChunkLength(long originalContentLength)
The chunk format is: chunk-size CRLF chunk-data CRLF.- Parameters:
originalContentLength
- Original Content length.- Returns:
- the length of this chunk
-
calculateStreamContentLength
public static long calculateStreamContentLength(long originalLength, long chunkSize)
Calculates the content length for data that is divided into chunks.- Parameters:
originalLength
- original content length.chunkSize
- chunk size- Returns:
- Content length of the trailer that will be appended at the end.
-
calculateChecksumTrailerLength
public static long calculateChecksumTrailerLength(Algorithm algorithm, String headerName)
Calculates the content length for a given algorithm and header name.- Parameters:
algorithm
- Algorithm used.headerName
- Header name.- Returns:
- Content length of the trailer that will be appended at the end.
-
createChecksumTrailer
public static ByteBuffer createChecksumTrailer(String computedChecksum, String trailerHeader)
Creates Chunk encoded checksum trailer for a computedChecksum which is in Base64 encoded.- Parameters:
computedChecksum
- Base64 encoded computed checksum.trailerHeader
- Header for the checksum data in the trailer.- Returns:
- Chunk encoded checksum trailer with given header.
-
createChunk
public static ByteBuffer createChunk(ByteBuffer chunkData, boolean isLastByte)
Creates ChunkEncoded data for an given chunk data.- Parameters:
chunkData
- chunk data that needs to be converted to chunk encoded format.isLastByte
- if true then additional CRLF will not be appended.- Returns:
- Chunk encoded format of a given data.
-
-