Class ByteBuffersAsyncRequestBody
- java.lang.Object
-
- software.amazon.awssdk.core.internal.async.ByteBuffersAsyncRequestBody
-
- All Implemented Interfaces:
AutoCloseable,org.reactivestreams.Publisher<ByteBuffer>,AsyncRequestBody,SdkPublisher<ByteBuffer>,SdkAutoCloseable
@SdkInternalApi public final class ByteBuffersAsyncRequestBody extends Object implements AsyncRequestBody, SdkAutoCloseable
An implementation ofAsyncRequestBodyfor providing data from the suppliedByteBufferarray. This is created using static methods onAsyncRequestBodySubscription Behavior:
- Each subscriber receives a read-only view of the buffered data
- Subscribers receive data independently based on their own demand signaling
- If the body is closed, new subscribers will receive an error immediately
Resource Management:
The body should be closed when no longer needed to free buffered data and notify active subscribers. Closing the body will:- Clear all buffered data
- Send error notifications to all active subscribers
- Prevent new subscriptions
- See Also:
AsyncRequestBody.fromBytes(byte[]),AsyncRequestBody.fromBytesUnsafe(byte[]),AsyncRequestBody.fromByteBuffer(ByteBuffer),AsyncRequestBody.fromByteBufferUnsafe(ByteBuffer),AsyncRequestBody.fromByteBuffers(ByteBuffer...),AsyncRequestBody.fromByteBuffersUnsafe(ByteBuffer...),AsyncRequestBody.fromString(String)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface software.amazon.awssdk.core.async.AsyncRequestBody
AsyncRequestBody.BodyType
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Stringbody()Each AsyncRequestBody should return a well-formed name that can be used to identify the implementation.List<ByteBuffer>bufferedData()voidclose()Optional<Long>contentLength()StringcontentType()static ByteBuffersAsyncRequestBodyfrom(byte[] bytes)static ByteBuffersAsyncRequestBodyfrom(String mimetype, byte[] bytes)static ByteBuffersAsyncRequestBodyof(Long length, ByteBuffer... buffers)static ByteBuffersAsyncRequestBodyof(String mimetype, Long length, ByteBuffer... buffers)static ByteBuffersAsyncRequestBodyof(String mimetype, ByteBuffer... buffers)static ByteBuffersAsyncRequestBodyof(ByteBuffer... buffers)static ByteBuffersAsyncRequestBodyof(List<ByteBuffer> buffers)static ByteBuffersAsyncRequestBodyof(List<ByteBuffer> buffers, long length)voidsubscribe(org.reactivestreams.Subscriber<? super ByteBuffer> subscriber)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface software.amazon.awssdk.core.async.AsyncRequestBody
split, split, splitCloseable, splitCloseable
-
Methods inherited from interface software.amazon.awssdk.core.async.SdkPublisher
addTrailingData, buffer, doAfterOnCancel, doAfterOnComplete, doAfterOnError, filter, filter, flatMapIterable, limit, map, subscribe
-
-
-
-
Method Detail
-
contentLength
public Optional<Long> contentLength()
- Specified by:
contentLengthin interfaceAsyncRequestBody- Returns:
- The content length of the data being produced.
-
contentType
public String contentType()
- Specified by:
contentTypein interfaceAsyncRequestBody- Returns:
- The content type of the data being produced.
-
subscribe
public void subscribe(org.reactivestreams.Subscriber<? super ByteBuffer> subscriber)
- Specified by:
subscribein interfaceorg.reactivestreams.Publisher<ByteBuffer>
-
body
public String body()
Description copied from interface:AsyncRequestBodyEach AsyncRequestBody should return a well-formed name that can be used to identify the implementation. The body name should only include alphanumeric characters.- Specified by:
bodyin interfaceAsyncRequestBody- Returns:
- String containing the identifying name of this AsyncRequestBody implementation.
-
of
public static ByteBuffersAsyncRequestBody of(List<ByteBuffer> buffers, long length)
-
of
public static ByteBuffersAsyncRequestBody of(List<ByteBuffer> buffers)
-
of
public static ByteBuffersAsyncRequestBody of(ByteBuffer... buffers)
-
of
public static ByteBuffersAsyncRequestBody of(Long length, ByteBuffer... buffers)
-
of
public static ByteBuffersAsyncRequestBody of(String mimetype, ByteBuffer... buffers)
-
of
public static ByteBuffersAsyncRequestBody of(String mimetype, Long length, ByteBuffer... buffers)
-
from
public static ByteBuffersAsyncRequestBody from(byte[] bytes)
-
from
public static ByteBuffersAsyncRequestBody from(String mimetype, byte[] bytes)
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceSdkAutoCloseable
-
bufferedData
@SdkTestInternalApi public List<ByteBuffer> bufferedData()
-
-