java IO 复制文件
 
学习记录 复制文件a.txt
 
import java
.io
.FileInputStream
;
import java
.io
.FileNotFoundException
;
import java
.io
.FileOutputStream
;
public class CopyTest {
    public static void main(String
[] args
) throws Exception 
{
    	
        FileInputStream fis 
= new FileInputStream("a.txt");
		
        FileOutputStream fos 
= new FileOutputStream("b.txt");
		
        byte[] buffer 
= new byte[1024];
        int len
;
        while((len
=fis
.read(buffer
))!=-1){
            fos
.write(buffer
,0,len
);
        }
		
        fis
.close();
        fos
.close();
    }
}
                
                
                
        
    
转载请注明原文地址:https://blackberry.8miu.com/read-3080.html