Class AbstractTranscoder
java.lang.Object
org.infinispan.commons.dataconversion.AbstractTranscoder
- All Implemented Interfaces:
Transcoder
- Direct Known Subclasses:
DefaultTranscoder,OneToManyTranscoder,TwoStepTranscoder
Class to inherit when implementing transcoders, will handle pre and post processing of the content.
- Since:
- 13.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected 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.Transcodes content between two differentMediaType.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.infinispan.commons.dataconversion.Transcoder
getSupportedMediaTypes, supports, supportsConversion
-
Constructor Details
-
AbstractTranscoder
public AbstractTranscoder()
-
-
Method Details
-
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
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.
-
doTranscode
-