public static byte[] bytes(File file) throws IOException {
        InputStream in = null;
        try {
            in = openInputStream(file);
            return toByteArray(in, file.length());
        } finally {
            closeQuietly(in);
        }
    }
public static byte [ ] bytes ( File file ) throws IOException { InputStream in = null ; try { in = openInputStream ( file ) ; return toByteArray ( in , file . length ( ) ) ; } finally { closeQuietly ( in ) ; } }
Reads the contents of a file into a byte array.
The file is always closed.

@param file the file to read, must not be {@code null}
@return the file contents, never {@code null}
@throws IOException in case of an I/O error
@since 1.1