@Immutable @ThreadSafe @LevelUpApi(contract=INTERNAL) public abstract class StringRequestBody extends Object implements RequestBody
A simple RequestBody
that stores the body as a String
.
As this implements the Parcelable
interface, subclasses must fully implement
the Parcelable
interface. This includes having both constructors that this
class defines, as well as the public static final
Parcelable.Creator
CREATOR
.
Parcelable.ClassLoaderCreator<T>, Parcelable.Creator<T>
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
Constructor and Description |
---|
StringRequestBody(Parcel source) |
StringRequestBody(String body) |
Modifier and Type | Method and Description |
---|---|
int |
describeContents() |
boolean |
equals(Object obj) |
int |
getContentLength() |
int |
hashCode() |
String |
toString() |
void |
writeToOutputStream(Context context,
OutputStream outputStream)
Write the body content to the output stream.
|
void |
writeToParcel(Parcel dest,
int flags) |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getContentType
public StringRequestBody(String body)
body
- the request bodypublic StringRequestBody(Parcel source)
source
- the source parcelpublic int describeContents()
describeContents
in interface Parcelable
public void writeToParcel(Parcel dest, int flags)
writeToParcel
in interface Parcelable
public void writeToOutputStream(Context context, OutputStream outputStream) throws IOException
RequestBody
writeToOutputStream
in interface RequestBody
context
- Android application context.outputStream
- the output stream to write to.IOException
- if there are any errors writing to the output stream.public int getContentLength()
getContentLength
in interface RequestBody