File file = new File(filePath);
FileInputStream in = null;
ByteArrayOutputStream out = new ByteArrayOutputStream();
try {
in = new FileInputStream(file);
byte[] buffer = new byte[in.available()];
in.read(buffer);
out.write(buffer);
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (in != null)
in.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}