Java FileInputStream Copy copyFile(File source, File target)

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

Description

copy File

License

Apache License

Declaration

private static void copyFile(File source, File target) throws IOException 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.io.*;

public class Main {
    private static void copyFile(File source, File target) throws IOException {
        try (InputStream in = new FileInputStream(source); OutputStream out = new FileOutputStream(target)) {
            byte[] buf = new byte[1024];
            int length;
            while ((length = in.read(buf)) > 0) {
                out.write(buf, 0, length);
            }/*from   w w w  . ja  va 2 s . c om*/
        }
    }
}

Related

  1. copyFile(File source, File destination)
  2. copyFile(File source, File target)
  3. copyFile(File source, File target)
  4. copyFile(File source, File target)
  5. copyFile(File source, File target)
  6. copyFile(File source, File target)
  7. copyFile(File source, File target)
  8. copyFile(File source, File target)
  9. copyFile(File source, File target)