protected byte[] toBytes(File file) {
        if (file == null) {
            throw new IllegalArgumentException("File argument cannot be null.");
        }
        try {
            return toBytes(new FileInputStream(file));
        } catch (FileNotFoundException e) {
            String msg = "Unable to acquire InputStream for file [" + file + "]";
            throw new CodecException(msg, e);
        }
    }
Converts the specified Object into a String.
<p/>
If the argument is a {@code byte[]} or {@code char[]} it will be converted to a String using the
{@link #PREFERRED_ENCODING}.  If a String, it will be returned as is.
<p/>
If the argument is anything other than these three types, it is passed to the
{@link #objectToString(Object) objectToString} method.

@param o the Object to convert into a byte array
@return a byte array representation of the Object argument.
src/main/java/org/apache/shiro/lang/codec/CodecSupport.java