public static void save(String filename,byte[] data) throws IOException { OutputStream out = null; try{ File file = new File(filename); File dir = getDirecotry(file); if(!dir.exists()){ dir.mkdirs(); } out = new FileOutputStream(file); out.write(data); out.flush(); }finally{ IO.close(out); } }