Java FileInputStream Copy copyFile(String src, String dest)

Here you can find the source of copyFile(String src, String dest)

Description

copy File

License

Creative Commons License

Declaration

public static void copyFile(String src, String dest) throws FileNotFoundException, IOException 

Method Source Code

//package com.java2s;
//License from project: Creative Commons License 

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class Main {
    public static void copyFile(String src, String dest) throws FileNotFoundException, IOException {
        int len;//  ww w  .  j a  va2  s  .  co  m
        FileInputStream in = new FileInputStream(new File(src));
        FileOutputStream out = new FileOutputStream(new File(dest));
        byte[] buf = new byte[1024];
        while ((len = in.read(buf)) > 0) {
            out.write(buf, 0, len);
        }
        in.close();
        out.close();
    }
}

Related

  1. copyFile(String sourceFilePath, String destinationFilePath)
  2. CopyFile(String sourceFilePath, String destinationFilePath)
  3. copyFile(String sourceFilePath, String destinationFilePath)
  4. copyFile(String sourcePath, String newPath)
  5. copyFile(String src, File dest)
  6. copyFile(String src, String dest)
  7. copyFile(String src, String dest)
  8. copyFile(String src, String dest)
  9. copyFile(String src, String dest)