Here you can find the source of readFile(String filename)
static protected byte[] readFile(String filename) throws IOException
//package com.java2s; /* Studio for kdb+ by Charles Skelton is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Germany License http://creativecommons.org/licenses/by-nc-sa/3.0 except for the netbeans components which retain their original copyright notice *//*ww w. ja va 2 s. c om*/ import java.io.*; public class Main { static protected byte[] readFile(String filename) throws IOException { File file = new File(filename); long len = file.length(); byte data[] = new byte[(int) len]; FileInputStream fin = new FileInputStream(file); int r = fin.read(data); if (r != len) throw new IOException("Only read " + r + " of " + len + " for " + file); fin.close(); return data; } }