Package org.simpleframework.http.message
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
class PartHeaderConsumer extends SegmentConsumer
ThePartHeaderConsumer
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
Fields Modifier and Type Field Description private Allocator
allocator
This is used to allocate the internal buffer for the header.private Buffer
buffer
This is the internal buffer used to store the header.-
Fields inherited from class org.simpleframework.http.message.SegmentConsumer
cookies, disposition, encoding, expect, header, language, length, limit, name, pos, scan, type, value
-
Fields inherited from class org.simpleframework.http.message.ArrayConsumer
array, chunk, count, done
-
-
Constructor Summary
Constructors Constructor Description PartHeaderConsumer(Allocator allocator)
Constructor for thePartHeaderConsumer
object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
append()
This is used to allocate the internal buffer and append the consumed bytes to the buffer.protected void
process()
This is used to process the header consumer once all of the headers have been read.-
Methods inherited from class org.simpleframework.http.message.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, white
-
Methods inherited from class org.simpleframework.http.message.ArrayConsumer
consume, isFinished
-
-
-
-
Constructor Detail
-
PartHeaderConsumer
public PartHeaderConsumer(Allocator allocator)
Constructor for thePartHeaderConsumer
object. 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 Detail
-
process
protected void process() throws java.io.IOException
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:
process
in classSegmentConsumer
- Throws:
java.io.IOException
-
append
private void append() throws java.io.IOException
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:
java.io.IOException
-
-