Package com.squareup.okhttp
Class Request.Body
java.lang.Object
com.squareup.okhttp.Request.Body
- Enclosing class:
- Request
public abstract static class Request.Body extends Object
-
Constructor Summary
Constructors Constructor Description Body() -
Method Summary
Modifier and Type Method Description longcontentLength()Returns the number of bytes in this body, or -1 if that count is unknown.MediaTypecontentType()Returns the Content-Type header for this body, or null if the content type is unknown.static Request.Bodycreate(MediaType contentType, byte[] content)Returns a new request body that transmitscontent.static Request.Bodycreate(MediaType contentType, File file)Returns a new request body that transmits the content offile.static Request.Bodycreate(MediaType contentType, String content)Returns a new request body that transmitscontent.abstract voidwriteTo(OutputStream out)Writes the content of this request toout.
-
Constructor Details
-
Body
public Body()
-
-
Method Details
-
contentType
Returns the Content-Type header for this body, or null if the content type is unknown. -
contentLength
public long contentLength()Returns the number of bytes in this body, or -1 if that count is unknown. -
writeTo
Writes the content of this request toout.- Throws:
IOException
-
create
Returns a new request body that transmitscontent. IfcontentTypelacks a charset, this will use UTF-8. -
create
Returns a new request body that transmitscontent. -
create
Returns a new request body that transmits the content offile.
-