Java File Copy nio copy(File source, File dest)

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

Description

Copy a file.

License

Open Source License

Parameter

Parameter Description
source the source file.
dest the destination file.

Exception

Parameter Description

Declaration

public static void copy(File source, File dest) throws IOException 

Method Source Code


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

import java.nio.file.Files;

public class Main {
    /**//from ww  w  .jav a2 s.  c o m
     * Copy a file.
     *
     * @param source the source file.
     * @param dest   the destination file.
     * @throws java.io.IOException if any errors occur during the copy.
     */
    public static void copy(File source, File dest) throws IOException {
        Files.copy(source.toPath(), dest.toPath());
    }
}

Related

  1. copy(File inFile, File outFile)
  2. copy(File input, File output)
  3. copy(File inputFile, OutputStream out)
  4. copy(File source, File dest)
  5. copy(File source, File dest)
  6. copy(File source, File dest)
  7. copy(File source, File dest)
  8. copy(File source, File dest, boolean preserveTime)
  9. copy(File source, File destination)