I have implemented similiar behaviour in my Application too without fail. Below is my version of code and it is functional.
byte[] getFileInBytes(String filename) {
File file = new File(filename);
int length = (int)file.length();
byte[] bytes = new byte[length];
try {
BufferedInputStream reader = new BufferedInputStream(new
FileInputStream(file));
reader.read(bytes, 0, length);
System.out.println(reader);
// setFile(bytes);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return bytes;
}