FileCopy

来源:互联网 发布:mac上其他怎么删除 编辑:程序博客网 时间:2024/06/06 00:46
package io;import java.io.*;public class FileCopy {public static void main(String[] args) {FileInputStream source = null;FileOutputStream destionation = null;try {source = new FileInputStream("d:/io/a.txt");destionation = new FileOutputStream("d:/io/b.txt");int data;while ((data = source.read()) != -1) {destionation.write(data);}} catch (Exception e) {// TODO Auto-generated catch blocke.printStackTrace();} finally {try {source.close();destionation.close();} catch (IOException e) {// TODO Auto-generated catch blocke.printStackTrace();}}}}


原创粉丝点击