Here you can find the source of readFileToBytes(File f)
public static byte[] readFileToBytes(File f) throws IOException
//package com.java2s; /**//from w w w. j av a2 s.c om * SlingBeans - NetBeans Sling plugin https://github.com/jkan997/SlingBeans Licensed under Apache 2.0 license http://www.apache.org/licenses/LICENSE-2.0 */ import java.io.*; public class Main { public static byte[] readFileToBytes(File f) throws IOException { int fLen = (int) f.length(); byte[] res = new byte[fLen]; FileInputStream fis = new FileInputStream(f); fis.read(res); fis.close(); return res; } }