Java File Copy fileCopy(String fromPath, String toPath)

Here you can find the source of fileCopy(String fromPath, String toPath)

Description

file Copy

License

Open Source License

Declaration

public static void fileCopy(String fromPath, String toPath) throws IOException 

Method Source Code


//package com.java2s;
/*//w  w w  . j ava  2s .co m
 * Copyright (C) 2003 by Institute for Systems Biology,
 * Seattle, Washington, USA.  All rights reserved.
 * 
 * This source code is distributed under the GNU Lesser 
 * General Public License, the text of which is available at:
 *   http://www.gnu.org/copyleft/lesser.html
 */

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

public class Main {
    public static void fileCopy(String fromPath, String toPath) throws IOException {
        File inputFile = new File(fromPath);
        File outputFile = new File(toPath);

        FileReader in = new FileReader(inputFile);
        FileWriter out = new FileWriter(outputFile);
        int c;

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

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

Related

  1. fileCopy(File source, String dest)
  2. fileCopy(File srcFile, File tarFile)
  3. FileCopy(InputStream input, OutputStream output, int bufferSize)
  4. fileCopy(String from, String to)
  5. fileCopy(String from, String to)
  6. fileCopy(String oldFilePath, String newFilePath, boolean isCover)
  7. fileCopy(String sFrom, String sTo)
  8. fileCopy(String source, String target)
  9. fileCopy(String sourceFile, String destinationFile)