Class ProgressReportingFileRequestBody

java.lang.Object
okhttp3.RequestBody
com.amilesend.onedrive.connection.file.ProgressReportingFileRequestBody

public class ProgressReportingFileRequestBody extends okhttp3.RequestBody
A customized implementation of RequestBody that invokes a TransferProgressCallback to notify of transfer updates for file uploads.
See Also:
  • Method Details

    • contentType

      public okhttp3.MediaType contentType()
      Gets the content type formatted as a MediaType.
      Specified by:
      contentType in class okhttp3.RequestBody
      Returns:
      the content type
    • getContentTypeStringValue

      public String getContentTypeStringValue()
      Gets the content type formatted as a string.
      Returns:
      the content type
    • contentLength

      public long contentLength()
      Gets the size of the configured file (in bytes).
      Overrides:
      contentLength in class okhttp3.RequestBody
      Returns:
      the size in bytes
    • writeTo

      public void writeTo(@NonNull okio.BufferedSink outputBufferedSink) throws IOException
      Writes the configured file to the given outputBufferedSink. This is typically a wrapped output stream for the request body.
      Specified by:
      writeTo in class okhttp3.RequestBody
      Parameters:
      outputBufferedSink - the sink to stream the file contents to
      Throws:
      IOException - if an error occurred while reading the configured file
    • builder