Class ByteArrayBodyGenerator.ByteBody
- java.lang.Object
-
- org.asynchttpclient.request.body.generator.ByteArrayBodyGenerator.ByteBody
-
- All Implemented Interfaces:
Closeable,AutoCloseable,Body
- Enclosing class:
- ByteArrayBodyGenerator
protected final class ByteArrayBodyGenerator.ByteBody extends Object implements Body
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.asynchttpclient.request.body.Body
Body.BodyState
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedByteBody()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()longgetContentLength()Gets the length of the body.Body.BodyStatetransferTo(io.netty.buffer.ByteBuf target)Reads the next chunk of bytes from the body.
-
-
-
Method Detail
-
getContentLength
public long getContentLength()
Description copied from interface:BodyGets the length of the body.- Specified by:
getContentLengthin interfaceBody- Returns:
- The length of the body in bytes, or negative if unknown.
-
transferTo
public Body.BodyState transferTo(io.netty.buffer.ByteBuf target)
Description copied from interface:BodyReads the next chunk of bytes from the body.A
Body.BodyState.STOPresult may be returned by the same call that writes the body's last bytes, sotargetcan still hold unread bytes on STOP. Consumers must draintargetbefore honouring STOP, otherwise the final chunk is lost.- Specified by:
transferToin interfaceBody- Parameters:
target- The buffer to store the chunk in, must not benull.- Returns:
- The state.
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
-