org.glassfish.jersey.message
Class DeflateEncoder

java.lang.Object
  extended by org.glassfish.jersey.spi.ContentEncoder
      extended by org.glassfish.jersey.message.DeflateEncoder
All Implemented Interfaces:
ReaderInterceptor, WriterInterceptor

public class DeflateEncoder
extends ContentEncoder

Deflate encoding support. Interceptor that encodes the output or decodes the input if Content-Encoding header value equals to deflate. The default behavior of this interceptor can be tweaked using MessageProperties.DEFLATE_WITHOUT_ZLIB property.

Author:
Martin Matula (martin.matula at oracle.com)

Constructor Summary
DeflateEncoder(Configuration config)
          Initialize DeflateEncoder.
 
Method Summary
 InputStream decode(String contentEncoding, InputStream encodedStream)
          Implementations of this method should take the encoded stream, wrap it and return a stream that can be used to read the decoded entity.
 OutputStream encode(String contentEncoding, OutputStream entityStream)
          Implementations of this method should take the entity stream, wrap it and return a stream that is encoded using the specified encoding.
 
Methods inherited from class org.glassfish.jersey.spi.ContentEncoder
aroundReadFrom, aroundWriteTo, getSupportedEncodings
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DeflateEncoder

@Inject
public DeflateEncoder(Configuration config)
Initialize DeflateEncoder.

Parameters:
config - Jersey configuration properties.
Method Detail

decode

public InputStream decode(String contentEncoding,
                          InputStream encodedStream)
                   throws IOException
Description copied from class: ContentEncoder
Implementations of this method should take the encoded stream, wrap it and return a stream that can be used to read the decoded entity.

Specified by:
decode in class ContentEncoder
Parameters:
contentEncoding - Encoding to be used to decode the stream - guaranteed to be one of the supported encoding values.
encodedStream - Encoded input stream.
Returns:
Decoded entity stream.
Throws:
IOException - if an IO error arises.

encode

public OutputStream encode(String contentEncoding,
                           OutputStream entityStream)
                    throws IOException
Description copied from class: ContentEncoder
Implementations of this method should take the entity stream, wrap it and return a stream that is encoded using the specified encoding.

Specified by:
encode in class ContentEncoder
Parameters:
contentEncoding - Encoding to be used to encode the entity - guaranteed to be one of the supported encoding values.
entityStream - Entity stream to be encoded.
Returns:
Encoded stream.
Throws:
IOException - if an IO error arises.


Copyright © 2007-2014, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.