Class InputStreamBody
- java.lang.Object
-
- org.apache.hc.client5.http.entity.mime.AbstractContentBody
-
- org.apache.hc.client5.http.entity.mime.InputStreamBody
-
- All Implemented Interfaces:
ContentBody,ContentDescriptor
public class InputStreamBody extends AbstractContentBody
Binary body part backed by an input stream.- Since:
- 4.0
- See Also:
MultipartEntityBuilder
-
-
Field Summary
Fields Modifier and Type Field Description private longcontentLengthprivate java.lang.Stringfilenameprivate java.io.InputStreamin
-
Constructor Summary
Constructors Constructor Description InputStreamBody(java.io.InputStream in, java.lang.String filename)InputStreamBody(java.io.InputStream in, org.apache.hc.core5.http.ContentType contentType)InputStreamBody(java.io.InputStream in, org.apache.hc.core5.http.ContentType contentType, java.lang.String filename)InputStreamBody(java.io.InputStream in, org.apache.hc.core5.http.ContentType contentType, java.lang.String filename, long contentLength)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetContentLength()Returns the body descriptors content-length.java.lang.StringgetFilename()java.io.InputStreamgetInputStream()voidwriteTo(java.io.OutputStream out)-
Methods inherited from class org.apache.hc.client5.http.entity.mime.AbstractContentBody
getCharset, getContentType, getMediaType, getMimeType, getSubType
-
-
-
-
Constructor Detail
-
InputStreamBody
public InputStreamBody(java.io.InputStream in, java.lang.String filename)
-
InputStreamBody
public InputStreamBody(java.io.InputStream in, org.apache.hc.core5.http.ContentType contentType, java.lang.String filename)- Since:
- 4.3
-
InputStreamBody
public InputStreamBody(java.io.InputStream in, org.apache.hc.core5.http.ContentType contentType, java.lang.String filename, long contentLength)- Since:
- 4.6
-
InputStreamBody
public InputStreamBody(java.io.InputStream in, org.apache.hc.core5.http.ContentType contentType)- Since:
- 4.3
-
-
Method Detail
-
getInputStream
public java.io.InputStream getInputStream()
-
writeTo
public void writeTo(java.io.OutputStream out) throws java.io.IOException- Throws:
java.io.IOException
-
getContentLength
public long getContentLength()
Description copied from interface:ContentDescriptorReturns the body descriptors content-length.- Returns:
- Content length, if known, or -1, to indicate the absence of a content-length header.
-
getFilename
public java.lang.String getFilename()
-
-