Android File Copy copy(File sourceFile, File destinationFile)

Here you can find the source of copy(File sourceFile, File destinationFile)

Description

copy

Declaration

public static void copy(File sourceFile, File destinationFile)
            throws IOException 

Method Source Code

//package com.java2s;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

public class Main {
    public static void copy(File sourceFile, File destinationFile)
            throws IOException {
        FileReader reader = null;
        FileWriter writer = null;

        try {/*  w w w.  ja va 2 s. c o  m*/
            reader = new FileReader(sourceFile);
            writer = new FileWriter(destinationFile);

            int data = reader.read();
            while (data != -1) {
                writer.write(data);
                data = reader.read();
            }
        } finally {
            if (writer != null) {
                writer.close();
            }

            if (reader != null) {
                reader.close();
            }
        }
    }
}

Related

  1. copy(File inFile, File outFile)
  2. copy(File pSourceFile, File pTargetFile)
  3. copy(File source, File target, boolean append)
  4. copy(File sourceFile, File targetFile)
  5. copy(File sourceFile, File targetFile, boolean overwrite)
  6. copy(File sourceFile, String destinction)
  7. copy(File src, File dest)