public Object encode(Object object) throws EncoderException {
try {
byte[] byteArray = object instanceof String ? ((String) object).getBytes(getCharsetName()) : (byte[]) object;
return encodeHex(byteArray);
} catch (ClassCastException e) {
throw new EncoderException(e.getMessage(), e);
} catch (UnsupportedEncodingException e) {
throw new EncoderException(e.getMessage(), e);
}
}