Is there any way to use the copy function of the operating system to copy and paste large files because I cannot think of any efficient algorithms for copying 125mb avi files. With the algorithm I have it takes around 5 minutes to copy one 125 MB file.

If I can't use the operating system default function, can anyone tell me how to speed up the process, because buffer size seems to have no effect on the speed

Here is the algorithm I'm using:

Code:

// Copy the file infile as another file in a different directory outfile
private static void copy(File infile, File outfile){

try{

//Open a stream of bytes to read the file bytes into the program
FileInputStream instream = new FileInputStream(infile);
//A stream of bytes from the program to the destination
FileOutputStream outstream = new FileOutputStream(outfile);
byte[] buffer = new byte[4096];
int bytesRead;
//Write the bytes from the inputstream to the outputstream
while((bytesRead = instream.read(buffer))!=-1){