- java.lang.Object
-
- org.asynchttpclient.request.body.generator.QueueBasedFeedableBodyGenerator<T>
-
- All Implemented Interfaces:
BodyGenerator
,FeedableBodyGenerator
- Direct Known Subclasses:
BoundedQueueFeedableBodyGenerator
,UnboundedQueueFeedableBodyGenerator
public abstract class QueueBasedFeedableBodyGenerator<T extends Queue<BodyChunk>> extends Object implements FeedableBodyGenerator
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
QueueBasedFeedableBodyGenerator(T queue)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Body
createBody()
Creates a new instance of the request body to be read.boolean
feed(io.netty.buffer.ByteBuf buffer, boolean isLast)
protected abstract boolean
offer(BodyChunk chunk)
void
setListener(FeedListener listener)
-
-
-
Constructor Detail
-
QueueBasedFeedableBodyGenerator
protected QueueBasedFeedableBodyGenerator(T queue)
-
-
Method Detail
-
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
.
-
feed
public boolean feed(io.netty.buffer.ByteBuf buffer, boolean isLast) throws Exception
- Specified by:
feed
in interfaceFeedableBodyGenerator
- Throws:
Exception
-
setListener
public void setListener(FeedListener listener)
- Specified by:
setListener
in interfaceFeedableBodyGenerator
-
-