Class AbstractTranscoder
- java.lang.Object
-
- org.infinispan.commons.dataconversion.AbstractTranscoder
-
- All Implemented Interfaces:
Transcoder
- Direct Known Subclasses:
DefaultTranscoder,OneToManyTranscoder
public abstract class AbstractTranscoder extends Object implements Transcoder
Class to inherit when implementing transcoders, will handle pre and post processing of the content.- Since:
- 13.0
-
-
Constructor Summary
Constructors Constructor Description AbstractTranscoder()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected ObjectdecodeContent(Object content, MediaType contentType)Decodes content before doing the transcoding.protected abstract ObjectdoTranscode(Object decoded, MediaType contentType, MediaType destinationType)protected ObjectencodeContent(Object content, MediaType destinationType)Encode the content after transcoding if necessary.Objecttranscode(Object content, MediaType contentType, MediaType destinationType)Transcodes content between two differentMediaType.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.infinispan.commons.dataconversion.Transcoder
getSupportedMediaTypes, supports, supportsConversion
-
-
-
-
Method Detail
-
decodeContent
protected Object decodeContent(Object content, MediaType contentType) throws UnsupportedEncodingException
Decodes content before doing the transcoding.- Parameters:
content- the content.contentType- theMediaTypedescribing the content.- Returns:
- an Object with the content decoded or the content itself if no decoding needed.
- Throws:
UnsupportedEncodingException- if an invalid encoding or type is provided.
-
encodeContent
protected Object encodeContent(Object content, MediaType destinationType) throws UnsupportedEncodingException
Encode the content after transcoding if necessary.- Parameters:
content- The content to encode.destinationType- The destinationMediaType- Returns:
- The value encoded or unchanged if no encoding is needed.
- Throws:
UnsupportedEncodingException
-
transcode
public Object transcode(Object content, MediaType contentType, MediaType destinationType)
Description copied from interface:TranscoderTranscodes content between two differentMediaType.- Specified by:
transcodein interfaceTranscoder- Parameters:
content- Content to transcode.contentType- TheMediaTypeof the content.destinationType- The targetMediaTypeto convert.- Returns:
- the transcoded content.
-
-