package fuzhi; import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException; public class CopyFile { public static void main(String[] args) {
// TODO Auto-generated method stub
CopyMp3 cy = new CopyMp3();
cy.copy();
} }
class CopyMp3{ public void CopyMp3(){}
void copy(){
long startTime = System.currentTimeMillis();//获取当前时间
try {
FileInputStream fis = new FileInputStream ("src/a.mp3");
FileOutputStream fos = new FileOutputStream ("src/temp.mp3");
//int read = fis.read();
byte[] bt = new byte[4096];
int n = 0;
while ( -1!=(n=fis.read(bt)) ) {
// fos.write(read);
// read = fis.read();
fos.write(bt, 0, n);
}
fis.close();
fos.close();
} catch (IOException e) {
e.printStackTrace();
} long endTime = System.currentTimeMillis();
System.out.println("程序运行时间: "+(endTime-startTime)+"ms");
}
}