给你写个例子,你看下- public static void main(String[] args) throws IOException
- {
- //获取键盘录入对象
- InputStream in = System.in;
- //将字节流对象转成字符流对象,使用转换流。InputStreamReader
- InputStreamReader isr = new InputStreamReader(in);
- //为了提高效率,将字符串进行缓冲区技术高效操作。使用BufferedReader
- BufferedReader br = new BufferedReader(isr);
- String line = null;
- while((line = br.readLine())!=null)
- {
- if("over".equals(line))
- break;
- System.out.println(line.toUpperCase());
- }
- br.close();
- }
复制代码 这个是输入流的转换。
输出流就是OutputStreamWriter |