Java FileInputStream Copy copyFile(String fileOutPut, String fileIn)

Here you can find the source of copyFile(String fileOutPut, String fileIn)

Description

copy File

License

Open Source License

Declaration

public static void copyFile(String fileOutPut, String fileIn) throws Exception 

Method Source Code

//package com.java2s;

import java.io.FileInputStream;
import java.io.FileOutputStream;

public class Main {
    public static void copyFile(String fileOutPut, String fileIn) throws Exception {
        FileInputStream fileInputStream = new FileInputStream(fileIn);
        FileOutputStream fileOutputStream = new FileOutputStream(fileOutPut);
        byte[] by = new byte[1024];
        int len;//ww w  . jav  a  2s  .  c o m
        while ((len = fileInputStream.read(by)) != -1) {
            fileOutputStream.write(by, 0, len);
        }
        fileInputStream.close();
        fileOutputStream.close();
    }
}

Related

  1. copyFile(OutputStream out, InputStream in)
  2. copyFile(String f1, String f2)
  3. copyFile(String fileIn, String fileOut)
  4. copyFile(String fileInName, String fileOutName)
  5. copyFile(String fileName, String fromDir, String toDir)
  6. copyFile(String from, String to)
  7. copyFile(String fromFile, String toFile)
  8. copyFile(String fromFilePath, String toFilePath)
  9. copyFile(String inFile, String outFile)