Package com.parse.http
Class ParseHttpBody
- java.lang.Object
-
- com.parse.http.ParseHttpBody
-
public abstract class ParseHttpBody extends java.lang.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 Description ParseHttpBody(java.lang.String contentType, long contentLength)
Creates anParseHttpBody
with givenContent-Type
andContent-Length
.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract java.io.InputStream
getContent()
Returns the content of this body.long
getContentLength()
Returns the number of bytes which will be written toout
whenwriteTo(java.io.OutputStream)
is called, or-1
if that count is unknown.java.lang.String
getContentType()
Returns theContent-Type
of this body.abstract void
writeTo(java.io.OutputStream out)
Writes the content of this request toout
.
-
-
-
Method Detail
-
getContent
public abstract java.io.InputStream getContent() throws java.io.IOException
Returns the content of this body.- Returns:
- The content of this body.
- Throws:
java.io.IOException
- Throws an exception if the content of this body is inaccessible.
-
writeTo
public abstract void writeTo(java.io.OutputStream out) throws java.io.IOException
Writes the content of this request toout
.- Parameters:
out
- The outputStream the content of this body needs to be written to.- Throws:
java.io.IOException
- Throws an exception if the content of this body can not be written toout
.
-
getContentLength
public long getContentLength()
Returns the number of bytes which will be written toout
whenwriteTo(java.io.OutputStream)
is called, or-1
if that count is unknown.- Returns:
- The Content-Length of this body.
-
getContentType
public java.lang.String getContentType()
Returns theContent-Type
of this body.- Returns:
- The
Content-Type
of this body.
-
-