Class FileInputBody

  • All Implemented Interfaces:

    
    public final class FileInputBody
    extends RequestBody
                        

    Represents the body of a network request containing a file input.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private String fileName
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final String getFileName() The name of the file to upload.
      final Unit setFileName(String fileName) The name of the file to upload.
      Unit writeToStream(BufferedSink bufferedSink) Writes the file content to the provided BufferedSink.
      String getContentType() Gets the content type of the file body.
      BufferedSource getSource() Gets a BufferedSource for reading the file content.
      • Methods inherited from class com.inmobi.media.network.okhttp.entity.body.RequestBody

        getEncoding
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FileInputBody

        FileInputBody(String fileName, String contentType, Integer encoding)
        Parameters:
        contentType - The content type of the file.
        encoding - The encoding of the file.
    • Method Detail

      • writeToStream

         Unit writeToStream(BufferedSink bufferedSink)

        Writes the file content to the provided BufferedSink.

        Parameters:
        bufferedSink - The sink to write the file data to.
      • getContentType

         String getContentType()

        Gets the content type of the file body.

        Returns:

        The content type string.

      • getSource

         BufferedSource getSource()

        Gets a BufferedSource for reading the file content.

        Returns:

        A BufferedSource for the file.