Class InputStreamBodyGenerator
- java.lang.Object
-
- org.asynchttpclient.request.body.generator.InputStreamBodyGenerator
-
- All Implemented Interfaces:
BodyGenerator
public final class InputStreamBodyGenerator extends Object implements BodyGenerator
ABodyGeneratorwhich use anInputStreamfor reading bytes, without having to read the entire stream in memory.
NOTE: TheInputStreammust support theInputStream.mark(int)andInputStream.reset()operation. If not, mechanisms like authentication, redirect, or resumable download will not work.
-
-
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 BodycreateBody()Creates a new instance of the request body to be read.longgetContentLength()InputStreamgetInputStream()
-
-
-
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:BodyGeneratorCreates 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 resent after an authentication challenge of a redirect.- Specified by:
createBodyin interfaceBodyGenerator- Returns:
- The request body, never
null.
-
-