| import java.io.*;class  CopyDemo
 {
 public static void main(String[] args)
 {
 System.out.println("Hello World!");
 
 method_2();
 }
  //拷贝一个mp3文件public static void method_2()
 {
 FileInputStream fi= null;
 FileOutputStream fo= null;
 try
 {
 fi = new FileInputStream("积木.mp3");
 fo = new FileOutputStream("积木_copy.mp3");
 BufferedReader br = new BufferedReader(new InputStreamReader(fi));
 BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(fo));
 String len = null;
 while((len = br.readLine())!=null)
 {
 bw.write(len);
 bw.newLine();
 bw.flush();
 }
           } catch (IOException e)
 {
 throw new RuntimeException("读写失败");
 }
 finally
 {
 try
 {
 if(fi!=null);
 fi.close();
 }
 catch (IOException e)
 {
 throw new RuntimeException("读入失败");
 }
 try
 {
 if(fo!=null);
 fo.close();
 }
 catch (IOException e)
 {
 throw new RuntimeException("写入失败");
 }
 
 }
  }
 } 
 
 |