Import Java.io.FileInputStream;
Import java.io.FileNotFoundException;
Import Java.io.FileOutputStream;
Import java.io.IOException;
public class copyfile{
public static void Copybytesfile (String sfilename,string dfilename)
throws ioexception{
//create file input stream object and file output stream object
FileInputStream fis = new FileInputStream (sfilename);
FileOutputStream fos = new FileOutputStream (dfilename);
//Looping the contents of a file and writing it out to an external file
int read = Fis.read ();//Read a byte from the associated source file, or 1 if the end of the file is reached.
while (read! =-1) {
fos.write (read);// Writes out a byte to its associated target file
read = Fis.read ();
}
//empty cache Close Stream object
fis.close ();
fos.close ();
}
public static void Main (string[] args) {
TODO auto-generated Method Stub
Long t1,t2;
T1 = System.currenttimemillis ();
try {
Copyfile.copybytesfile ("A.mp3", "Temp.mp3");
} catch (IOException e) {
TODO auto-generated Catch block
E.printstacktrace ();
}
T2 = System.currenttimemillis ();
System.out.println ("spents" + (T1-T2));
}
}
Java fourth time job