public static byte [ ] readFileToBytes ( String filePath ) throws IOException { Path path = Paths . get ( filePath ) ; byte [ ] bytes = Files . readAllBytes ( path ) ; return bytes ; }
Read a file into a byte array .