Java FileReader Copy copyFile(File inputFile, File outputFile)

Here you can find the source of copyFile(File inputFile, File outputFile)

Description

copy File

License

Open Source License

Declaration

public static void copyFile(File inputFile, File outputFile) throws IOException 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

public class Main {
    public static void copyFile(File inputFile, File outputFile) throws IOException {
        outputFile.getParentFile().mkdirs();
        FileReader in = new FileReader(inputFile);
        FileWriter out = new FileWriter(outputFile);
        int c;//from  w  w  w . java2s .  c  o  m

        while ((c = in.read()) != -1)
            out.write(c);

        in.close();
        out.close();
    }
}

Related

  1. copyFile(File source, File destination)
  2. copyFile(String fromFilePath, String toFileDir)
  3. copyFile(String input, String output)
  4. copyFile(String inputName, String destination)