Class ChunkBuffer
- java.lang.Object
-
- software.amazon.awssdk.core.internal.async.ChunkBuffer
-
public final class ChunkBuffer extends Object
Class that will buffer incoming BufferBytes to chunks of bufferSize. If totalBytes is not provided, i.e. content-length is unknown,getBufferedData()
should be used in the Subscriber'sonComplete()
to check for a final chunk that is smaller than the chunk size, and send if present.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
ChunkBuffer.Builder
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ChunkBuffer.Builder
builder()
Optional<ByteBuffer>
getBufferedData()
Retrieve the current buffered data.Iterable<ByteBuffer>
split(ByteBuffer inputByteBuffer)
Split the inputByteBuffer
into multiple smallerByteBuffer
s, each of which containschunkSize
worth of bytes.
-
-
-
Method Detail
-
builder
public static ChunkBuffer.Builder builder()
-
split
public Iterable<ByteBuffer> split(ByteBuffer inputByteBuffer)
Split the inputByteBuffer
into multiple smallerByteBuffer
s, each of which containschunkSize
worth of bytes. If the last chunk of the input ByteBuffer contains less thanchunkSize
data, the last chunk will be buffered.
-
getBufferedData
public Optional<ByteBuffer> getBufferedData()
Retrieve the current buffered data.
-
-