Class PartHeaderConsumer
java.lang.Object
org.simpleframework.http.message.ArrayConsumer
org.simpleframework.http.message.SegmentConsumer
org.simpleframework.http.message.PartHeaderConsumer
- All Implemented Interfaces:
ByteConsumer, Segment
The
PartHeaderConsumer object is used to consume the
header for a multipart message. This performs a parse of the
HTTP headers within the message up to the terminal carriage return
and line feed token. Once this had been read the contents of the
header are appended to a buffer so they can be read later.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate AllocatorThis is used to allocate the internal buffer for the header.private BufferThis is the internal buffer used to store the header.Fields inherited from class SegmentConsumer
cookies, disposition, encoding, expect, header, language, length, limit, name, pos, scan, type, valueFields inherited from class ArrayConsumer
array, chunk, count, done -
Constructor Summary
ConstructorsConstructorDescriptionPartHeaderConsumer(Allocator allocator) Constructor for thePartHeaderConsumerobject. -
Method Summary
Methods inherited from class SegmentConsumer
add, adjust, cookie, disposition, encoding, end, equal, expect, getContentLength, getContentType, getDisposition, getFileName, getLocales, getName, getTransferEncoding, getValue, getValue, getValues, headers, isExpectContinue, isFile, language, length, resize, scan, space, terminal, toString, type, whiteMethods inherited from class ArrayConsumer
consume, isFinished
-
Field Details
-
allocator
This is used to allocate the internal buffer for the header. -
buffer
This is the internal buffer used to store the header.
-
-
Constructor Details
-
PartHeaderConsumer
Constructor for thePartHeaderConsumerobject. An allocator is required so that the header consumer can create a buffer to store the contents of the consumed message.- Parameters:
allocator- this is the allocator used to create a buffer
-
-
Method Details
-
process
This is used to process the header consumer once all of the headers have been read. This will simply parse all of the headers and append the consumed bytes to the internal buffer. Appending the bytes ensures that the whole upload can be put back together as a single byte stream if required.- Overrides:
processin classSegmentConsumer- Throws:
IOException
-
append
This is used to allocate the internal buffer and append the consumed bytes to the buffer. Once the header is added to the internal buffer this is finished and the next part of the upload can be consumed.- Throws:
IOException
-