Android File Copy copy(String input, String output)

Here you can find the source of copy(String input, String output)

Description

This class copies an input file to output file

Parameter

Parameter Description
String output file

Declaration

public static boolean copy(String input, String output)
        throws Exception 

Method Source Code

//package com.java2s;
import java.io.*;

public class Main {
    /**// w w  w .j a  va2  s .c  om
     *  This class copies an input file to output file
     *
     *  @param String input file to copy from
     *  @param String output file
     */
    public static boolean copy(String input, String output)
            throws Exception {
        int BUFSIZE = 65536;
        FileInputStream fis = new FileInputStream(input);
        FileOutputStream fos = new FileOutputStream(output);

        try {
            int s;
            byte[] buf = new byte[BUFSIZE];
            while ((s = fis.read(buf)) > -1) {
                fos.write(buf, 0, s);
            }

        } catch (Exception ex) {
            throw new Exception("makehome" + ex.getMessage());
        } finally {
            fis.close();
            fos.close();
        }
        return true;
    }
}

Related

  1. copy(File sourceFile, File destinationFile)
  2. copy(File sourceFile, File targetFile)
  3. copy(File sourceFile, File targetFile, boolean overwrite)
  4. copy(File sourceFile, String destinction)
  5. copy(File src, File dest)
  6. copy(String pSourceFile, String pTargetFile)
  7. copy(String source, String destinction)
  8. copy(String srcFileName, String destFileName)
  9. copyBundleFile(IPath projectRelativePath, String outputPath)