java-buffer flow to input packaging

Source: Internet
Author: User

/* Character stream: Filereaderfilewriter. Bufferedreaderbufferedwriter byte stream: Fileinputstreamfileoutputstreambufferedinputstreambufferedoutputstream input a row of data through the keyboard and print its uppercase , the discovery is actually the principle of reading a row of data. That is the ReadLine method. Can you directly use the ReadLine method to complete the reading of a row of data on the keyboard input? The ReadLine method is a method in the character stream BufferedReader class. The Read method of keyboard input is the method of byte stream inputstream. Then can the byte flow into a character stream in the use of character stream buffer ReadLine method? */import java.io.*;class transstreamdemo{public static void Main (string[] args) throws ioexception{//gets the keyboard entry object. InputStream in = system.in;//converts a byte stream object into a character stream object, using the transform stream. Inputstreamreader//inputstreamreader ISR = new InputStreamReader (in);//In order to improve efficiency, the string is efficiently manipulated by buffer technology. Use Bufferedreader//bufferedreader BUFR = new BufferedReader (ISR);//keyboard The most common notation. BufferedReader bufr = new BufferedReader (new InputStreamReader (system.in));//outputstream out = system.out;// OutputStreamWriter OSW = new OutputStreamWriter (out);//bufferedwriter BUFW = new BufferedWriter (OSW); BufferedWriter BUFW = new BufferedWriter (new OutputStreamWriter (System.out)); String line = Null;while ((Line=bufr.readline ())!=null) {if (' over '). EquaLS (line)) Break;bufw.write (Line.touppercase ()); Bufw.newline (); Bufw.flush ();} Bufr.close ();}}

  

java-buffer flow to input packaging

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.