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

public Class InputStreamBody

extends AbstractContentBody
Class Inheritance
Imports
java.io.IOException, .InputStream, .OutputStream, org.apache.hc.core5.http.ContentType, org.apache.hc.core5.util.Args

Binary body part backed by an input stream.
Since
4.0
See Also
org.apache.hc.client5.http.entity.mime.MultipartEntityBuilder

Field Summary

Modifier and TypeField and Description
private final long
private final String
private final InputStream

Constructor Summary

AccessConstructor and Description
public
InputStreamBody(final InputStream in, final String filename)

public
InputStreamBody(final InputStream in, final ContentType contentType, final String filename)

public
InputStreamBody(final InputStream in, final ContentType contentType, final String filename, final long contentLength)

public
InputStreamBody(final InputStream in, 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 InputStream
public void
Inherited from org.apache.hc.client5.http.entity.mime.AbstractContentBody:
getCharsetgetContentTypegetMediaTypegetMimeTypegetSubType

Field Detail

contentLengthback to summary
private final long contentLength
filenameback to summary
private final String filename
inback to summary
private final InputStream in

Constructor Detail

InputStreamBodyback to summary
public InputStreamBody(final InputStream in, final String filename)
InputStreamBodyback to summary
public InputStreamBody(final InputStream in, final ContentType contentType, final String filename)
Since
4.3
InputStreamBodyback to summary
public InputStreamBody(final InputStream in, final ContentType contentType, final String filename, final long contentLength)
Since
4.6
InputStreamBodyback to summary
public InputStreamBody(final InputStream in, 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
getInputStreamback to summary
public InputStream getInputStream()
writeToback to summary
public void writeTo(final OutputStream out) throws IOException

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

Annotations
@Override