Java FileChannel Copy copyFile(File src, File dst)

Here you can find the source of copyFile(File src, File dst)

Description

copy File

License

Open Source License

Declaration

public final static void copyFile(File src, File dst) throws IOException 

Method Source Code


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

import java.io.*;
import java.nio.channels.FileChannel;

public class Main {
    public final static void copyFile(File src, File dst) throws IOException {
        FileChannel src_channel = new FileInputStream(src).getChannel();
        FileChannel dst_channel = new FileOutputStream(dst).getChannel();
        src_channel.transferTo(0, Long.MAX_VALUE, dst_channel);
        src_channel.close();//from  w w  w  .  j av  a2  s. co m
        dst_channel.close();
    }
}

Related

  1. copyFile(File src, File dest)
  2. copyFile(File src, File dest)
  3. copyFile(File src, File dest)
  4. copyFile(File src, File destination)
  5. copyFile(File src, File destination)
  6. copyFile(File src, File dst)
  7. copyFile(File src, File dst)
  8. copyFile(File src, File dst)
  9. copyFile(File src, File dst)