public class FileUploadConsumer extends Object implements BodyConsumer
FileUploadConsumer
object is used to consume a
list of parts encoded in the multipart format. This is can consume
any number of parts from a cursor. Each part consumed is added to an
internal part list which can be used to acquire the contents of the
upload and inspect the headers provided for each uploaded part. To
ensure that only a fixed number of bytes are consumed this wraps
the provided cursor with a counter to ensure reads a limited amount.Constructor and Description |
---|
FileUploadConsumer(Allocator allocator,
byte[] boundary,
long length)
Constructor for the
FileUploadConsumer object. |
Modifier and Type | Method and Description |
---|---|
void |
consume(ByteCursor cursor)
This method is used to consume bytes from the provided cursor.
|
Body |
getBody()
This is used to acquire the body that has been consumed.
|
boolean |
isFinished()
This is used to determine whether the consumer has finished
reading.
|
public FileUploadConsumer(Allocator allocator, byte[] boundary, long length)
FileUploadConsumer
object.
This is used to create an object that read a series of parts
from a fixed length body. When consuming the body this will not
read any more than the content length from the cursor.allocator
- this is the allocator used to allocate buffersboundary
- this is the boundary that is used by thislength
- this is the number of bytes for this part seriespublic Body getBody()
Part
objects.
Each part can then be read as an individual message.getBody
in interface BodyConsumer
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
public boolean isFinished()
isFinished
in interface ByteConsumer
Copyright © 2017. All rights reserved.