Class Encoder

java.lang.Object
org.apache.juneau.encoders.Encoder
Direct Known Subclasses:
EncoderSet.Inherit, EncoderSet.NoInherit, GzipEncoder, IdentityEncoder

public abstract class Encoder extends Object
Used for enabling decompression on requests and compression on responses, such as support for GZIP compression.
Description
Used to wrap input and output streams within compression/decompression streams.

Encoders are registered with RestServlets through the @Rest(encoders) annotation.

Notes:
  • This class is thread safe and reusable.
See Also:
  • Constructor Details

  • Method Details

    • getInputStream

      public abstract InputStream getInputStream(InputStream is) throws IOException
      Converts the specified compressed input stream into an uncompressed stream.
      Parameters:
      is - The compressed stream.
      Returns:
      The uncompressed stream.
      Throws:
      IOException - If any errors occur, such as on a stream that's not a valid GZIP input stream.
    • getOutputStream

      Converts the specified uncompressed output stream into an uncompressed stream.
      Parameters:
      os - The uncompressed stream.
      Returns:
      The compressed stream stream.
      Throws:
      IOException - If any errors occur.
    • getCodings

      public abstract String[] getCodings()
      Returns the codings in Content-Encoding and Accept-Encoding headers that this encoder handles (e.g. "gzip").
      Returns:
      The codings that this encoder handles.