Java tutorial
import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; public class Util { public static byte[] readFile(String filename) throws IOException { File file = new File(filename); return readFile(file); } public static byte[] readFile(File file) throws IOException { BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file)); int bytes = (int) file.length(); byte[] buffer = new byte[bytes]; int readBytes = bis.read(buffer); bis.close(); return buffer; } }