Class RequestBody


  • public abstract class RequestBody
    extends Object
    • Constructor Detail

      • RequestBody

        public RequestBody()
    • Method Detail

      • contentType

        public abstract MediaType contentType()
        Returns the Content-Type header for this body.
      • create

        public static RequestBody create​(MediaType contentType,
                                         String content)
        Returns a new request body that transmits content. If contentType is non-null and lacks a charset, this will use UTF-8.
      • create

        public static RequestBody create​(MediaType contentType,
                                         byte[] content)
        Returns a new request body that transmits content.
      • create

        public static RequestBody create​(MediaType contentType,
                                         byte[] content,
                                         int offset,
                                         int byteCount)
        Returns a new request body that transmits content.
      • create

        public static RequestBody create​(MediaType contentType,
                                         File file)
        Returns a new request body that transmits the content of file.