Interface ContentEncoding

  • All Known Implementing Classes:
    IdentityContentEncoding

    public interface ContentEncoding
    Interface for defining HTTP encoding handlers. A HTTP encoding handler is able to decode data from an InputStream and encode data to an OutputStream.

    Encodings are specified in HTTP headers such as content-encoding, transfer-encoding, accept-encoding.

    Encoding handlers should be registered in the HttpServer in order to use them.

    See Also:
    EncodingRegistry.registerContentEncoding(ContentEncoding)
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.lang.String getId()
      Returns the name of the supported encoding.
      java.io.InputStream open​(java.io.InputStream original)
      Returns an InputStream to read the decoded data from the original InputStream.
      java.io.OutputStream open​(java.io.OutputStream original)
      Wraps the original OutputStream with a special OutputStream which performs the encoding.
    • Method Detail

      • getId

        java.lang.String getId()
        Returns the name of the supported encoding.
        Returns:
        an internal String in lower case format.
      • open

        java.io.InputStream open​(java.io.InputStream original)
                          throws java.io.IOException
        Returns an InputStream to read the decoded data from the original InputStream.
        Parameters:
        original - the InputStream to read the encoded data.
        Returns:
        the InputStream to 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.IOException
        Wraps the original OutputStream with a special OutputStream which performs the encoding. Returns an OutputStream to encode the data from the original OutputStream.
        Parameters:
        original - the output stream to wrap.
        Returns:
        the OutputStream to encode the data.
        Throws:
        java.io.IOException - if any I/O error occurs.