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 .