zoukankan      html  css  js  c++  java
  • FileCpoy --- 代码

     1 import java.io.* ;
     2 
     3 public class FileCopy {
     4     public static void main(String[] args) {
     5         String inputFile = "D:/java03/day23/Test.txt" ;
     6         String outputFile = "D:/LX/Test.txt" ;
     7         
     8         FileReader r = null;
     9         FileWriter w = null;
    10         
    11         try {
    12             r = new FileReader(new File(inputFile));
    13             w = new FileWriter(new File(outputFile));
    14             int b = 0;
    15             
    16             while((b = r.read()) != -1) {
    17                 w.write(b);
    18             }
    19             w.flush();
    20             
    21         }catch(FileNotFoundException ex) {
    22             ex.printStackTrace();
    23         }catch(IOException ex) {
    24             ex.printStackTrace();
    25         }finally {
    26             try{
    27                 r.close();
    28                 w.close();
    29             }catch(IOException ex) {
    30                 ex.printStackTrace();
    31             }
    32         }
    33         System.out.println("复制完成!");
    34         
    35     }
    36 }
  • 相关阅读:
    前端基础知识1
    mysql作业
    mysql了解知识点
    mysql3
    数据库作业2
    循环结构经典题型
    计算1
    猜数字游戏
    css的显示
    定位和position定位
  • 原文地址:https://www.cnblogs.com/xuewuzhijing95hao/p/7120386.html
Copyright © 2011-2022 走看看