Java Basics Review of Javaio---bufferedinputstream and bufferedoutputstream

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.