public static byte [ ] readBytes ( File file ) throws IOException { byte [ ] bytes = new byte [ ( int ) file . length ( ) ] ; FileInputStream fileInputStream = new FileInputStream ( file ) ; DataInputStream dis = new DataInputStream ( fileInputStream ) ; try { dis . readFully ( bytes ) ; InputStream temp = dis ; dis = null ; temp . close ( ) ; } finally { closeWithWarning ( dis ) ; } return bytes ; }
Reads the content of the file into a byte array .