private static void CopyFile (String src,string DST)
{
Bufferedinputstream Bis=null;
Bufferedoutputstream Bos=null;
byte buf[]=new byte[1024];
try{
Bis=new Bufferedinputstream (New FileInputStream (SRC));
Bos=new Bufferedoutputstream (New FileOutputStream (DST));
int len=0;
while (true) {
Len=bis.read (BUF);
if (len<=0) break;
Bos.write (Buf,0,len);
}
The buffer is only full until the data is output to the output stream, and flush () forces the data in the not full buffer out
Bos.flush ();
}catch (Exception e) {
E.printstacktrace ();
}finally{
if (bis! = null) try{bis.close ();} catch (Exception e) {e.printstacktrace ();}
if (bos!= null) try{bos.close ();} catch (Exception e) {e.printstacktrace ();}
}
}
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.