@Priority(value=4000) @Contract public abstract class ContentEncoder extends Object implements javax.ws.rs.ext.ReaderInterceptor, javax.ws.rs.ext.WriterInterceptor
WriterInterceptor
and decoding ReaderInterceptor
. Implementing this class ensures the encoding
supported by the implementation will be considered during the content negotiation phase when deciding which encoding
should be used based on the accepted encodings (and the associated quality parameters) in the request headers.Modifier | Constructor and Description |
---|---|
protected |
ContentEncoder(String... supportedEncodings)
Initializes this encoder implementation with the list of supported content encodings.
|
Modifier and Type | Method and Description |
---|---|
Object |
aroundReadFrom(javax.ws.rs.ext.ReaderInterceptorContext context) |
void |
aroundWriteTo(javax.ws.rs.ext.WriterInterceptorContext context) |
abstract 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.
|
abstract 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.
|
Set<String> |
getSupportedEncodings()
Returns values of Content-Encoding header supported by this encoder.
|
protected ContentEncoder(String... supportedEncodings)
supportedEncodings
- Values of Content-Encoding header supported by this encoding provider.public final Set<String> getSupportedEncodings()
public abstract InputStream decode(String contentEncoding, InputStream encodedStream) throws IOException
contentEncoding
- Encoding to be used to decode the stream - guaranteed to be one of the supported encoding
values.encodedStream
- Encoded input stream.IOException
- if an IO error arises.public abstract OutputStream encode(String contentEncoding, OutputStream entityStream) throws IOException
contentEncoding
- Encoding to be used to encode the entity - guaranteed to be one of the supported encoding
values.entityStream
- Entity stream to be encoded.IOException
- if an IO error arises.public final Object aroundReadFrom(javax.ws.rs.ext.ReaderInterceptorContext context) throws IOException, javax.ws.rs.WebApplicationException
aroundReadFrom
in interface javax.ws.rs.ext.ReaderInterceptor
IOException
javax.ws.rs.WebApplicationException
public final void aroundWriteTo(javax.ws.rs.ext.WriterInterceptorContext context) throws IOException, javax.ws.rs.WebApplicationException
aroundWriteTo
in interface javax.ws.rs.ext.WriterInterceptor
IOException
javax.ws.rs.WebApplicationException
Copyright © 2007-2021, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.