package string.itcastio;

import java.io.*;

/*
 * 字符流
 *      1,FileReader
 *      2,FileWriter
 *      3,BufferedReader
 *      4,BufferedWriter
 * 字节流
 *      1,InputStream
 *      2,OutputStream
 *      3,BufferedInputStream
 *      4,BufferedOutputStream
 *      
 *      InputStreamReader:
 *      是字节流通向字符流的桥梁
 */
public class InputStreamReaderDemo1 {
    public static void main(String[] args) throws IOException {
        //获取键盘输入对象
        InputStream is = System.in;
        //将字节流转换为字符流对象,使用转换流InputStreamReader
        InputStreamReader isr = new InputStreamReader(is);
        //为了提高效率,使用字符缓冲区技术高效操作,使用BufferedReader
        BufferedReader br = new BufferedReader(isr);
//键盘录入最常见写法
        //BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String line
= null; while ((line = br.readLine()) != null) { if ("over".equals(line)) { break; } System.out.println(line); } } }

 

版权声明:本文为guwenren原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/guwenren/archive/2013/03/23/2977162.html