public abstract class UpdateConsumer extends Object implements BodyConsumer
UpdateConsumer
object is used to create a consumer
that is used to consume and process large bodies. Typically a large
body will be one that is delivered as part of a multipart upload
or as a large form POST. The task of the large consumer is to
consume all the bytes for the body, and reset the cursor after the
last byte that has been send with the body. This ensures that the
next character read from the cursor is the first character of a
HTTP header within the pipeline.Modifier and Type | Field and Description |
---|---|
protected byte[] |
array
This is an external array used to copy data between buffers.
|
protected boolean |
finished
This is used to determine whether the consumer has finished.
|
Modifier | Constructor and Description |
---|---|
protected |
UpdateConsumer()
Constructor for the
UpdateConsumer object. |
protected |
UpdateConsumer(int chunk)
Constructor for the
UpdateConsumer object. |
Modifier and Type | Method and Description |
---|---|
protected void |
commit(ByteCursor cursor)
This method can be used to commit the consumer when all data
has been consumed.
|
void |
consume(ByteCursor cursor)
This method is used to consume bytes from the provided cursor.
|
boolean |
isFinished()
This is used to determine whether the consumer has finished
reading.
|
protected abstract int |
update(byte[] array,
int off,
int count)
This is used to process the bytes that have been read from the
cursor.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getBody
protected byte[] array
protected boolean finished
protected UpdateConsumer()
UpdateConsumer
object. This is
used to create a consumer with a one kilobyte buffer used to
read the contents from the cursor and transfer it to the buffer.protected UpdateConsumer(int chunk)
UpdateConsumer
object. This is
used to create a consumer with a variable size buffer used to
read the contents from the cursor and transfer it to the buffer.chunk
- this is the size of the buffer used to read bytespublic boolean isFinished()
isFinished
in interface ByteConsumer
public void consume(ByteCursor cursor) throws IOException
ByteCursor
object should be
read. If there are no ready bytes then this will return.consume
in interface ByteConsumer
cursor
- used to consume the bytes from the HTTP pipelineIOException
protected void commit(ByteCursor cursor) throws IOException
cursor
- this is the cursor used by this consumerIOException
protected abstract int update(byte[] array, int off, int count) throws IOException
array
- this is a chunk read from the cursoroff
- this is the offset within the array the chunk startscount
- this is the number of bytes within the arrayIOException
Copyright © 2022. All rights reserved.