FileInputStream in = new FileInputStream("filename");
int readCount;
byte[] buf = new byte[4096];while((readCount=in.read(buf))!=-1){
...
}
int readCount;
byte[] buf = new byte[4096];while((readCount=in.read(buf))!=-1){
...
}
byte[] b=new byte[4096];
int read=0;
FileInputStream fis=new FileInputStream(fromFile);
FileOutputStream fos=new FileOutputStream(toFile);
BufferedInputStream bis=new BufferedInputStream(fis);
BufferedOutputStream bos=new BufferedOutputStream(fos);
while ((read=bis.read(b))!=-1) {
bos.write(b,0,read);
bos.flush();
}
bos.close();
bis.close();
fos.close();
fis.close();
} catch (Exception e) {
e.printStackTrace();
}