com.parse.http

## Class ParseHttpBody

- java.lang.Object
- - com.parse.http.ParseHttpBody

    public abstract class ParseHttpBody
    extends Object

The base interface of a http body. It can be implemented by different http libraries such as Apache http, Android URLConnection, Square OKHttp and so on.

### Constructor Summary

Constructors
Constructor and Description
`ParseHttpBody(String contentType, long contentLength)` Creates an `ParseHttpBody` with given `Content-Type` and `Content-Length`.

### Method Summary

Methods
`abstract InputStream` `getContent()` Returns the content of this body.
`long` `getContentLength()` Returns the number of bytes which will be written to `out` when `ParseHttpBody.writeTo(java.io.OutputStream)` is called, or `-1` if that count is unknown.
`String` `getContentType()` Returns the `Content-Type` of this body.
`abstract void` `writeTo(OutputStream out)` Writes the content of this request to `out`.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### ParseHttpBody

    public ParseHttpBody(String contentType,
                 long contentLength)

Creates an `ParseHttpBody` with given `Content-Type` and `Content-Length`.

Parameters:
  `contentType` - The `Content-Type` of the `ParseHttpBody`.
  `contentLength` - The `Content-Length` of the `ParseHttpBody`.

### Method Detail

#### getContent

    public abstract InputStream getContent()
                                    throws IOException

Returns the content of this body.

Returns:
  The content of this body.
Throws:
  `IOException` - Throws an exception if the content of this body is inaccessible.

#### writeTo

    public abstract void writeTo(OutputStream out)
                          throws IOException

Writes the content of this request to `out`.

Parameters:
  `out` - The outputStream the content of this body needs to be written to.
Throws:
  `IOException` - Throws an exception if the content of this body can not be written to `out`.

#### getContentLength

    public long getContentLength()

Returns the number of bytes which will be written to `out` when `ParseHttpBody.writeTo(java.io.OutputStream)` is called, or `-1` if that count is unknown.

Returns:
  The Content-Length of this body.

#### getContentType

    public String getContentType()

Returns the `Content-Type` of this body.

Returns:
  The `Content-Type` of this body.