Class SimpleBody
java.lang.Object
org.apache.hc.client5.http.async.methods.SimpleBody
Message body representation as a simple text string or an array of bytes.
- Since:
- 5.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final byte[]private final Stringprivate final org.apache.hc.core5.http.ContentType -
Constructor Summary
ConstructorsConstructorDescriptionSimpleBody(byte[] bodyAsBytes, String bodyAsText, org.apache.hc.core5.http.ContentType contentType) -
Method Summary
Modifier and TypeMethodDescription(package private) static SimpleBodycreate(byte[] body, org.apache.hc.core5.http.ContentType contentType) (package private) static SimpleBodybyte[]Gets the body as a byte array.Gets the body as a String.org.apache.hc.core5.http.ContentTypeGets the content type.booleanisBytes()Tests whether the body is currently cached as a byte array.booleanisText()Tests whether the body is currently cached as a String.toString()
-
Field Details
-
bodyAsBytes
private final byte[] bodyAsBytes -
bodyAsText
-
contentType
private final org.apache.hc.core5.http.ContentType contentType
-
-
Constructor Details
-
SimpleBody
SimpleBody(byte[] bodyAsBytes, String bodyAsText, org.apache.hc.core5.http.ContentType contentType)
-
-
Method Details
-
create
-
create
-
getContentType
public org.apache.hc.core5.http.ContentType getContentType()Gets the content type.- Returns:
- the content type.
-
getBodyBytes
public byte[] getBodyBytes()Gets the body as a byte array.- Returns:
- the body as a byte array.
-
getBodyText
-
isText
public boolean isText()Tests whether the body is currently cached as a String.- Returns:
- whether the body is currently cached as a String.
-
isBytes
public boolean isBytes()Tests whether the body is currently cached as a byte array.- Returns:
- whether the body is currently cached as a byte array.
-
toString
-