public interface TransferEncoding
The HTTP transfer coding handler decodes data from the body of a HttpRequest
and encodes the body of a
HttpResponse
.
Transfer coding is specified in transfer-encoding
HTTP header.
Encoding handlers should be registered in the HttpServer
in order to use them.
Modifier and Type | Method and Description |
---|---|
String |
getId()
Returns the supported encoding id.
|
InputStream |
open(HttpRequest request,
InputStream input)
Opens an
InputStream that can be used to decode message body of the given request. |
OutputStream |
open(HttpResponse response,
OutputStream output)
Opens an
OutputStream that can be used to encode the message body of the HttpResponse . |
String getId()
String
in lower case format.InputStream open(HttpRequest request, InputStream input) throws IOException
InputStream
that can be used to decode message body of the given request. The returned
InputStream
MUST conforms to the followings:
InputStream
MUST reach the EOF (i.e. read methods returns -1
) when the request body
has been completely read.InputStream.close()
method MUST read any remaining bytes from the message body (if any) and MUST
NOT close the underlying stream.request
- the HttpRequest
to be decoded by this transfer coding handler.input
- the InputStream
from which encoded message body can be read.InputStream
used to decode message body of the given request.IOException
- if any I/O Error occurs.OutputStream open(HttpResponse response, OutputStream output) throws IOException
OutputStream
that can be used to encode the message body of the HttpResponse
.response
- the HttpResponse
to be encoded by this transfer coding handler.output
- the OutputStream
where the encoded message body is written.IOException
- if any I/O Error occurs.