public class EntityConsumer extends Object implements ByteConsumer
EntityConsumer
object is used to consume data
from a cursor and build a request entity. Each constituent part of
the entity is consumed from the pipeline and can be acquired from
this consumer object. The Header
and Body
can be used to extract the individual parts of the entity.Modifier and Type | Field and Description |
---|---|
protected BodyConsumer |
body
This is used to consume the body for the request entity.
|
protected org.simpleframework.http.message.ContinueDispatcher |
dispatcher
This is used to determine if there a continue is expected.
|
protected org.simpleframework.http.message.ConsumerFactory |
factory
This is used to create a body consumer for the entity.
|
protected RequestConsumer |
header
This is used to consume the header for the request entity.
|
protected Trace |
trace
This is used to trace the progress of the request consumption.
|
Constructor and Description |
---|
EntityConsumer(Allocator allocator,
Channel channel)
Constructor for the
EntityConsumer object. |
Modifier and Type | Method and Description |
---|---|
void |
consume(ByteCursor cursor)
This consumes the header and body from the cursor.
|
Body |
getBody()
This is used to acquire the body for this HTTP entity.
|
Header |
getHeader()
This provides the HTTP request header for the entity.
|
boolean |
isFinished()
This is determined finished when the body has been consumed.
|
boolean |
isHeaderFinished()
This is used to determine if the header has finished.
|
protected org.simpleframework.http.message.ContinueDispatcher dispatcher
protected org.simpleframework.http.message.ConsumerFactory factory
protected RequestConsumer header
protected BodyConsumer body
protected Trace trace
public EntityConsumer(Allocator allocator, Channel channel)
EntityConsumer
object. This
is used to build an entity from the constituent parts. Once
all of the parts have been consumed they are available from
the exposed methods of this consumed instance.allocator
- this is used to allocate the memory usedchannel
- this is the channel used to send a responsepublic Body getBody()
Attachment
objects.
Each part can then be read as an individual message.public Header getHeader()
public void consume(ByteCursor cursor) throws IOException
consume
in interface ByteConsumer
cursor
- used to consumed the bytes for the entityIOException
public boolean isFinished()
isFinished
in interface ByteConsumer
public boolean isHeaderFinished()
Copyright © 2022. All rights reserved.