Android Utililty Methods File Copy

List of utility methods to do File Copy

Description

The list of methods to do File Copy are organized into topic(s).

Method

voidcopyFile(File aSourceFile, File aTargetFile, boolean aAppend)
copy File
FileChannel inChannel = null;
FileChannel outChannel = null;
FileInputStream inStream = null;
FileOutputStream outStream = null;
try {
    inStream = new FileInputStream(aSourceFile);
    inChannel = inStream.getChannel();
    outStream = new FileOutputStream(aTargetFile, aAppend);
...
voidcopyFile(File from, File to)
copy File
if (!from.exists()) {
    return;
FileInputStream in = null;
FileOutputStream out = null;
try {
    in = new FileInputStream(from);
    out = new FileOutputStream(to);
...
StringCopyCacheFile(Context con, String assetsFile)
Copy Cache File
String out = getSdcardFilesDir(con) + assetsFile;
copyTo(con, assetsFile, out);
File f = new File(out);
if (!f.exists()) {
    return null;
return out;
StringCopyFile(Context con, String assetsFile)
Copy File
String out = getDataFilesDir(con) + assetsFile;
copyTo(con, assetsFile, out);
File f = new File(out);
if (!f.exists()) {
    return null;
return out;
voidcopyFile(File from, File to)
copy File
if (!from.exists()) {
    return;
FileInputStream in = null;
FileOutputStream out = null;
try {
    in = new FileInputStream(from);
    out = new FileOutputStream(to);
...
voidcopyFile(File from, File to)
copy File
if (!from.exists()) {
    return;
FileInputStream in = null;
FileOutputStream out = null;
try {
    in = new FileInputStream(from);
    out = new FileOutputStream(to);
...
voidcopyFile(File sourceFile, File targetFile)
copy File
BufferedInputStream inBuff = null;
BufferedOutputStream outBuff = null;
if (null != sourceFile && null != targetFile) {
    try {
        inBuff = new BufferedInputStream(new FileInputStream(
                sourceFile));
        outBuff = new BufferedOutputStream(new FileOutputStream(
                targetFile));
...
voidcopyFile(String source, String dest)
copy File
File sourceFile = new File(source);
File destFile = new File(dest);
destFile.createNewFile();
InputStream in = new FileInputStream(sourceFile);
OutputStream out = new FileOutputStream(destFile);
byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf)) > 0) {
...