public final class FileAsyncRequestBody extends Object implements AsyncRequestBody
AsyncRequestBody
that reads data from a file.Modifier and Type | Class and Description |
---|---|
static interface |
FileAsyncRequestBody.Builder
A builder for
FileAsyncRequestBody . |
Modifier and Type | Method and Description |
---|---|
static FileAsyncRequestBody.Builder |
builder() |
int |
chunkSizeInBytes() |
Optional<Long> |
contentLength() |
String |
contentType() |
long |
fileLength() |
long |
numBytesToRead() |
Path |
path() |
long |
position() |
SdkPublisher<AsyncRequestBody> |
split(AsyncRequestBodySplitConfiguration splitConfiguration)
Converts this
AsyncRequestBody to a publisher of AsyncRequestBody s, each of which publishes a specific
portion of the original data, based on the provided AsyncRequestBodySplitConfiguration . |
void |
subscribe(org.reactivestreams.Subscriber<? super ByteBuffer> s) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
empty, forBlockingInputStream, forBlockingOutputStream, fromByteBuffer, fromByteBuffers, fromByteBuffersUnsafe, fromByteBufferUnsafe, fromBytes, fromBytesUnsafe, fromFile, fromFile, fromFile, fromFile, fromInputStream, fromPublisher, fromRemainingByteBuffer, fromRemainingByteBuffers, fromRemainingByteBuffersUnsafe, fromRemainingByteBufferUnsafe, fromString, fromString, split
adapt, buffer, doAfterOnCancel, doAfterOnComplete, doAfterOnError, filter, filter, flatMapIterable, limit, map, subscribe
public SdkPublisher<AsyncRequestBody> split(AsyncRequestBodySplitConfiguration splitConfiguration)
AsyncRequestBody
AsyncRequestBody
to a publisher of AsyncRequestBody
s, each of which publishes a specific
portion of the original data, based on the provided AsyncRequestBodySplitConfiguration
. The default chunk size
is 2MB and the default buffer size is 8MB.
By default, if content length of this AsyncRequestBody
is present, each divided AsyncRequestBody
is
delivered to the subscriber right after it's initialized. On the other hand, if content length is null, it is sent after
the entire content for that chunk is buffered. In this case, the configured maxMemoryUsageInBytes
must be larger
than or equal to chunkSizeInBytes
. Note that this behavior may be different if a specific implementation of this
interface overrides this method.
split
in interface AsyncRequestBody
AsyncRequestBodySplitConfiguration
public Path path()
public long fileLength()
public int chunkSizeInBytes()
public long position()
public long numBytesToRead()
public Optional<Long> contentLength()
contentLength
in interface AsyncRequestBody
public String contentType()
contentType
in interface AsyncRequestBody
public void subscribe(org.reactivestreams.Subscriber<? super ByteBuffer> s)
subscribe
in interface org.reactivestreams.Publisher<ByteBuffer>
public static FileAsyncRequestBody.Builder builder()
FileAsyncRequestBody
.Copyright © 2023. All rights reserved.