MP3 the replication process:
PackageCom.lp.ecjtu;ImportJava.io.BufferedInputStream;ImportJava.io.BufferedOutputStream;ImportJava.io.FileInputStream;Importjava.io.FileNotFoundException;ImportJava.io.FileOutputStream;Importjava.io.IOException;/** * * @authorAdministrator * Demo MP3 copy * bufferedoutputstream * Bufferedinputstream **/ Public classCopymp3stream {/** * @paramargs *@throwsIOException*/ Public Static voidMain (string[] args)throwsIOException {LongStartTime =System.currenttimemillis (); Copy_1 (); LongEndTime =System.currenttimemillis (); System.out.println ("Total Cost" + (Endtime-starttime) + "millisecond"); } Public Static voidCopy_1 ()throwsioexception{//creates an internal buffer array, reads the data from the hard disk into the buffer, and the byte stream bufferBufferedinputstream Bufios =NewBufferedinputstream (NewFileInputStream ("D:\\1.mp3")); Bufferedoutputstream Buffos=NewBufferedoutputstream (NewFileOutputStream ("2.mp3")); intby = 0; while((By=bufios.read ())! =-1) {//reads buffer data into the input streamBuffos.write (by);//write to the output stream} buffos.close (); Bufios.close (); }}
Java Basics Review of Javaio---bufferedinputstream and bufferedoutputstream