public Object encode ( Object object ) throws EncoderException { try { byte [ ] byteArray = object instanceof String ? ( ( String ) object ) . getBytes ( ) : ( byte [ ] ) object ; return encodeHex ( byteArray ) ; } catch ( ClassCastException e ) { throw new EncoderException ( e . getMessage ( ) ) ; } }
Converts a String or an array of bytes into an array of characters representing the hexidecimal values of each byte in order . The returned array will be double the length of the passed String or array as it takes two characters to represent any given byte .