Here you can find the source of readFile(String file)
public static byte[] readFile(String file)
//package com.java2s; //License from project: LGPL import java.io.File; import java.io.RandomAccessFile; public class Main { public static byte[] readFile(String file) { return readFile(new File(file)); }// w w w.ja v a 2s .co m public static byte[] readFile(File file) { byte[] fileContent = null; try { RandomAccessFile f = null; try { f = new RandomAccessFile(file, "r"); byte[] b = new byte[(int) f.length()]; f.read(b); fileContent = b; } finally { f.close(); } } catch (Exception e) { } return fileContent; } }