Class UnsignedChunksInputStream

java.lang.Object
java.io.InputStream
org.apache.hadoop.ozone.s3.UnsignedChunksInputStream
All Implemented Interfaces:
Closeable, AutoCloseable

public class UnsignedChunksInputStream extends InputStream
Input stream implementation to read body of an unsigned chunked upload.

Currently, the only valid value of x-amz-content-sha256 header to indicate transfer unsigned payload in multiple chunks is STREAMING-UNSIGNED-PAYLOAD-TRAILER. Therefore, the input stream should work with chunked payloads with checksum trailer. Nevertheless, this input stream also supports chunked upload without trailer.

Example chunk data:

 10000\r\n
 <65536-bytes>\r\n
 0\r\n
 x-amz-checksum-crc64nvme:2wstOANdZ/o=\r\n
 

The 10000 will be read and decoded from base-16 representation to 65536, which is the size of the subsequent chunk payload. Each chunk upload ends with a zero-byte final additional chunk. At the end, there will be a trailer checksum payload

The logic is similar to SignedChunksInputStream, but since it is an unsigned chunked upload there is no "chunk-signature" to parse.

Note that there is not actual trailer checksum verification taking place. The InputStream only returns the actual chunk payload from chunked signatures format.

Reference: