Class MessageBodyDechunker

java.lang.Object
org.omegazero.http.h1.MessageBodyDechunker

public class MessageBodyDechunker extends Object
Used for parsing HTTP/1 message bodies, for example with the chunked transfer encoding.

Each MessageBodyDechunker is initialized with a single HTTPMessage of which the body is parsed. Data received for this HTTPMessage is then passed to addData(byte[]), which parses the data and, if a full chunk was received, calls the callback passed in the constructor. If the end of the body is reached, this callback is called with a byte array of length 0.

If chunked transfer encoding is used, a buffer size must be given. This buffer is used for temporarily storing the data chunks. If a single chunk is larger than this buffer, it will be passed to the callback as multiple chunks.

This class is not thread-safe.

Since:
1.2.1
API Note:
Ported from the native HTTP/1 implementation of omz-proxy with minor changes