Here you can find the source of readFile(String imageName)
public static byte[] readFile(String imageName)
//package com.java2s; /**// w w w .j a v a2 s .c om * based on source code from k5 * http://www.magentocommerce.com/boards/viewthread/37982/ * * @author Pawel Konczalski <mail@konczalski.de> * * You are free to use it under the terms of the GNU General Public License */ import java.io.File; import java.io.FileInputStream; import java.io.IOException; public class Main { public static byte[] readFile(String imageName) { byte[] buf = null; try { File file = new File(imageName); buf = new byte[(int) file.length()]; FileInputStream fis = new FileInputStream(file); fis.read(buf); fis.close(); } catch (IOException e) { System.err.println(e); } return buf; } }