public static ByteArrayOutputStream getOutputStream(String filePath){

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 (Exception e2) {
}

}
return out;
}