copy file in android app

‮ttual.www‬uri.com
copy file in android app

make a copy of file in android:

public static void copy(File src, File dst) throws IOException {
    InputStream in = new FileInputStream(src);
    try {
        OutputStream out = new FileOutputStream(dst);
        try {
            // Transfer bytes from in to out
            byte[] buf = new byte[1024];
            int len;
            while ((len = in.read(buf)) > 0) {
                out.write(buf, 0, len);
            }
			// success
        } finally {
            out.close();
        }
    } finally {
        in.close();
    }
}
Created Time:2017-08-31 16:05:21  Author:lautturi