Package ej.hoka.http.encoding
Interface ContentEncoding
-
- All Known Implementing Classes:
IdentityContentEncoding
public interface ContentEncodingInterface for defining HTTP encoding handlers. A HTTP encoding handler is able to decode data from anInputStreamand encode data to anOutputStream.Encodings are specified in HTTP headers such as
content-encoding,transfer-encoding,accept-encoding.Encoding handlers should be registered in the
HttpServerin order to use them.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description StringgetId()Returns the name of the supported encoding.InputStreamopen(InputStream original)OutputStreamopen(OutputStream original)
-
-
-
Method Detail
-
getId
String getId()
Returns the name of the supported encoding.- Returns:
- an internal
Stringin lower case format.
-
open
InputStream open(InputStream original) throws IOException
- Parameters:
original- theInputStreamto read the encoded data.- Returns:
- the
InputStreamto read the decoded data. - Throws:
IOException- if any I/O error occurs.
-
open
OutputStream open(OutputStream original) throws IOException
Wraps theoriginalOutputStreamwith a specialOutputStreamwhich performs the encoding. Returns anOutputStreamto encode the data from theoriginalOutputStream.- Parameters:
original- the output stream to wrap.- Returns:
- the
OutputStreamto encode the data. - Throws:
IOException- if any I/O error occurs.
-
-