Class InputStreamBodyGenerator
- java.lang.Object
-
- org.asynchttpclient.request.body.generator.InputStreamBodyGenerator
-
- All Implemented Interfaces:
BodyGenerator
public final class InputStreamBodyGenerator extends Object implements BodyGenerator
ABodyGenerator
which use anInputStream
for reading bytes, without having to read the entire stream in memory.
NOTE: TheInputStream
must support theInputStream.mark(int)
andInputStream.reset()
operation. If not, mechanisms like authentication, redirect, or resumable download will not works.
-
-
Constructor Summary
Constructors Constructor Description InputStreamBodyGenerator(InputStream inputStream)
InputStreamBodyGenerator(InputStream inputStream, long contentLength)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Body
createBody()
Creates a new instance of the request body to be read.long
getContentLength()
InputStream
getInputStream()
-
-
-
Constructor Detail
-
InputStreamBodyGenerator
public InputStreamBodyGenerator(InputStream inputStream)
-
InputStreamBodyGenerator
public InputStreamBodyGenerator(InputStream inputStream, long contentLength)
-
-
Method Detail
-
getInputStream
public InputStream getInputStream()
-
getContentLength
public long getContentLength()
-
createBody
public Body createBody()
Description copied from interface:BodyGenerator
Creates a new instance of the request body to be read. While each invocation of this method is supposed to create a fresh instance of the body, the actual contents of all these body instances is the same. For example, the body needs to be resend after an authentication challenge of a redirect.- Specified by:
createBody
in interfaceBodyGenerator
- Returns:
- The request body, never
null
.
-
-