@Override public Object transcode(Object content, MediaType contentType, MediaType destinationType) { try { if (destinationType.equals(APPLICATION_UNKNOWN)) { if (contentType.match(APPLICATION_UNKNOWN)) return content; return convertToByteArray(content, contentType); } if (destinationType.match(APPLICATION_OCTET_STREAM)) { return convertToOctetStream(content, contentType, destinationType); } if (destinationType.match(APPLICATION_OBJECT)) { return convertToObject(content, contentType, destinationType); } if (destinationType.match(TEXT_PLAIN)) { return convertToTextPlain(content, contentType, destinationType); } if (destinationType.match(APPLICATION_WWW_FORM_URLENCODED)) { return convertToUrlEncoded(content, contentType); } throw log.unsupportedContent(content); } catch (EncodingException | InterruptedException | IOException e) { throw log.unsupportedContent(content); } }