Top Description Fields Constructors Methods
org.apache.hc.client5.http.entity.mime

public Class StringBody

extends AbstractContentBody
Class Inheritance
Imports
java.io.ByteArrayInputStream, .IOException, .InputStreamReader, .OutputStream, .Reader, java.nio.charset.Charset, .StandardCharsets, org.apache.hc.core5.http.ContentType, org.apache.hc.core5.util.Args

Text body part backed by a byte array.
Since
4.0
See Also
org.apache.hc.client5.http.entity.mime.MultipartEntityBuilder

Field Summary

Modifier and TypeField and Description
private final byte[]

Constructor Summary

AccessConstructor and Description
public
StringBody(final String text, final ContentType contentType)

Method Summary

Modifier and TypeMethod and Description
public long
getContentLength()

Implements org.apache.hc.client5.http.entity.mime.ContentDescriptor.getContentLength.

Returns the body descriptors content-length.
public String
public Reader
public void
Inherited from org.apache.hc.client5.http.entity.mime.AbstractContentBody:
getCharsetgetContentTypegetMediaTypegetMimeTypegetSubType

Field Detail

contentback to summary
private final byte[] content

Constructor Detail

StringBodyback to summary
public StringBody(final String text, final ContentType contentType)
Since
4.3

Method Detail

getContentLengthback to summary
public long getContentLength()

Implements org.apache.hc.client5.http.entity.mime.ContentDescriptor.getContentLength.

Doc from org.apache.hc.client5.http.entity.mime.ContentDescriptor.getContentLength.

Returns the body descriptors content-length.

Returns:long

Content length, if known, or -1, to indicate the absence of a content-length header.

Annotations
@Override
getFilenameback to summary
public String getFilename()

Implements org.apache.hc.client5.http.entity.mime.ContentBody.getFilename.

Annotations
@Override
getReaderback to summary
public Reader getReader()
writeToback to summary
public void writeTo(final OutputStream out) throws IOException

Implements org.apache.hc.client5.http.entity.mime.ContentBody.writeTo.

Annotations
@Override