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 java.lang.StringgetId()Returns the name of the supported encoding.java.io.InputStreamopen(java.io.InputStream original)Returns anInputStreamto read the decoded data from theoriginalInputStream.java.io.OutputStreamopen(java.io.OutputStream original)Wraps theoriginalOutputStreamwith a specialOutputStreamwhich performs the encoding.
-
-
-
Method Detail
-
getId
java.lang.String getId()
Returns the name of the supported encoding.- Returns:
- an internal
Stringin lower case format.
-
open
java.io.InputStream open(java.io.InputStream original) throws java.io.IOExceptionReturns anInputStreamto read the decoded data from theoriginalInputStream.- Parameters:
original- theInputStreamto read the encoded data.- Returns:
- the
InputStreamto read the decoded data. - Throws:
java.io.IOException- if any I/O error occurs.
-
open
java.io.OutputStream open(java.io.OutputStream original) throws java.io.IOExceptionWraps 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:
java.io.IOException- if any I/O error occurs.
-
-