Here you can find the source of copyFileUsingStream(File source, File dest)
public static void copyFileUsingStream(File source, File dest) throws IOException
//package com.java2s; //License from project: LGPL import java.io.*; public class Main { public static void copyFileUsingStream(File source, File dest) throws IOException { InputStream is = null;/*from w ww. j a v a 2 s.c om*/ OutputStream os = null; try { is = new FileInputStream(source); os = new FileOutputStream(dest); byte[] buffer = new byte[1024]; int length; while ((length = is.read(buffer)) > 0) { os.write(buffer, 0, length); } } finally { is.close(); os.close(); } } }