java 转换流测试二

package org.lunzi.test.io;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class TestTransForm2 {

public static void main(String[] args) {
//运行过程中可能出现阻塞
/**
* java.lang.Object
         *   java.io.Reader
         *     java.io.InputStreamReader
         *     是字节流通向字符流的桥梁
*/

InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
String line = null;
try {
while ((line = br.readLine()) != null) {
if (line.equalsIgnoreCase(
"exit")) {
break;
}
System.out.println(line.toUpperCase());
}
br.close();
} catch (IOException e) {
e.printStackTrace();
}
}

}

lunzi   2008-11-08 22:13:36 评论:1   阅读:463   引用:0

发表评论>>

署名发表(评论可管理,不必输入下面的姓名)

姓名:

主题:

内容: 最少15个,最长1000个字符

验证码: (如不清楚,请刷新)

Copyright@2004-2010 powered by YuLog