Class FileAsyncRequestBody
- java.lang.Object
-
- software.amazon.awssdk.core.internal.async.FileAsyncRequestBody
-
- All Implemented Interfaces:
org.reactivestreams.Publisher<ByteBuffer>,AsyncRequestBody,SdkPublisher<ByteBuffer>
public final class FileAsyncRequestBody extends Object implements AsyncRequestBody
Implementation ofAsyncRequestBodythat reads data from a file.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceFileAsyncRequestBody.BuilderA builder forFileAsyncRequestBody.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static FileAsyncRequestBody.Builderbuilder()intchunkSizeInBytes()Optional<Long>contentLength()StringcontentType()longfileLength()longnumBytesToRead()Pathpath()longposition()SdkPublisher<AsyncRequestBody>split(AsyncRequestBodySplitConfiguration splitConfiguration)Converts thisAsyncRequestBodyto a publisher ofAsyncRequestBodys, each of which publishes a specific portion of the original data, based on the providedAsyncRequestBodySplitConfiguration.voidsubscribe(org.reactivestreams.Subscriber<? super ByteBuffer> s)-
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
-
Methods inherited from interface software.amazon.awssdk.core.async.SdkPublisher
addTrailingData, buffer, doAfterOnCancel, doAfterOnComplete, doAfterOnError, filter, filter, flatMapIterable, limit, map, subscribe
-
-
-
-
Method Detail
-
split
public SdkPublisher<AsyncRequestBody> split(AsyncRequestBodySplitConfiguration splitConfiguration)
Description copied from interface:AsyncRequestBodyConverts thisAsyncRequestBodyto a publisher ofAsyncRequestBodys, each of which publishes a specific portion of the original data, based on the providedAsyncRequestBodySplitConfiguration. The default chunk size is 2MB and the default buffer size is 8MB.By default, if content length of this
AsyncRequestBodyis present, each dividedAsyncRequestBodyis 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 configuredmaxMemoryUsageInBytesmust be larger than or equal tochunkSizeInBytes. Note that this behavior may be different if a specific implementation of this interface overrides this method.- Specified by:
splitin interfaceAsyncRequestBody- See Also:
AsyncRequestBodySplitConfiguration
-
path
public Path path()
-
fileLength
public long fileLength()
-
chunkSizeInBytes
public int chunkSizeInBytes()
-
position
public long position()
-
numBytesToRead
public long numBytesToRead()
-
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> s)
- Specified by:
subscribein interfaceorg.reactivestreams.Publisher<ByteBuffer>
-
builder
public static FileAsyncRequestBody.Builder builder()
- Returns:
- Builder instance to construct a
FileAsyncRequestBody.
-
-