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 of AsyncRequestBody that reads data from a file.
See Also:
  • Method Details

    • split

      Description copied from interface: AsyncRequestBody
      Converts this AsyncRequestBody to a publisher of AsyncRequestBodys, 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.

      Specified by:
      split in interface AsyncRequestBody
      See Also:
    • 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:
      contentLength in interface AsyncRequestBody
      Returns:
      The content length of the data being produced.
    • contentType

      public String contentType()
      Specified by:
      contentType in interface AsyncRequestBody
      Returns:
      The content type of the data being produced.
    • subscribe

      public void subscribe(org.reactivestreams.Subscriber<? super ByteBuffer> s)
      Specified by:
      subscribe in interface org.reactivestreams.Publisher<ByteBuffer>
    • body

      public String body()
      Description copied from interface: AsyncRequestBody
      Each 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:
      body in interface AsyncRequestBody
      Returns:
      String containing the identifying name of this AsyncRequestBody implementation.
    • builder

      public static FileAsyncRequestBody.Builder builder()
      Returns:
      Builder instance to construct a FileAsyncRequestBody.