标签:java class style import 执行 dex exception oid 思想
package com.sxt.copy2; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.Reader; import java.io.Writer; /* * 字符输入输出流 * Reader * Writer */ public class TestCopy { public static void main(String[] args) { Reader reader = null; Writer writer = null; try { reader = new FileReader("F:\\01_面向对象设计思想_重要_1.avi"); writer = new FileWriter("G:\\CopyDest.avi"); char[] cbuf = new char[1024]; //第一步:读文件到程序 int len = 0; while((len = reader.read(cbuf))!= -1){ System.out.println(len); writer.write(cbuf, 0, len);//第二部:从程序写到文件中 } System.out.println("Copy执行完成!"); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); }finally{ if(reader != null){ try { reader.close(); } catch (IOException e) { e.printStackTrace(); } } if(writer != null){ try { writer.close(); } catch (IOException e) { e.printStackTrace(); } } } } }
标签:java class style import 执行 dex exception oid 思想
原文地址:http://www.cnblogs.com/qingfengzhuimeng/p/6764098.html