Android File Copy fileCopy(File dbFile, File backup)

Here you can find the source of fileCopy(File dbFile, File backup)

Description

file Copy

Declaration

private static void fileCopy(File dbFile, File backup)
            throws IOException 

Method Source Code

//package com.java2s;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.channels.FileChannel;

public class Main {
    private static void fileCopy(File dbFile, File backup)
            throws IOException {
        FileChannel inChannel = new FileInputStream(dbFile).getChannel();
        FileChannel outChannel = new FileOutputStream(backup).getChannel();
        try {/*www .j  a  va  2 s .  c om*/
            inChannel.transferTo(0, inChannel.size(), outChannel);
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } finally {
            if (inChannel != null) {
                inChannel.close();
            }
            if (outChannel != null) {
                outChannel.close();
            }
        }
    }
}

Related

  1. copyImgFile(String sourcePath, String fileId)
  2. copyResource(Class cls, String strResSource, String strFile)
  3. copyStringToFile(String content, String FilePath)
  4. copyfile(File source, File destination)
  5. dumbfilecopy(File source, File dest)
  6. fileCopy(File sourcefile, File destinctionFile)
  7. fileCopy(File sourcefile, String destinctionFile)
  8. fileCopy(String sourcefile, String destinctionFile)
  9. bakFile(String source, String dest)