import java.io.*; public class test13_6 { public static void main(String []args) throws Exception { FileOutputStream output=null; FileInputStream input=null; BufferedOutputStream buffout=null; BufferedInputStream buffin=null; byte[]bytes=new byte[1024];//放一個空數組 args[0]="C:\\Users\\ASUS\\Desktop\\"+args[0];//只有在命令行輸入,表示輸入 args[1]="C:\\Users\\ASUS\\Desktop\\"+args[1];//命令行,表示輸出 input=new FileInputStream(args[0]); output=new FileOutputStream(args[1]); buffin=new BufferedInputStream(input); buffout=new BufferedOutputStream(output); int len ; while((len= input.read(b)) != -1) { buffout.write(bytes,0,len); } buffin.close(); buffout.close(); input.close(); output.close(); } }
Buffered緩衝仍是沒感受這個流多快,就是統一進磁盤,加快速度,或許吧java