Method that can be used to serialize any Java value as a byte array. Functionally equivalent to calling {@link #writeValue(Writer,Object)} with {@link java.io.ByteArrayOutputStream}and getting bytes, but more efficient. Encoding used will be UTF-8.
Note: prior to version 2.1, throws clause included {@link IOException}; 2.1 removed it.