package com.qunar.basicJava.javase.io;
import java.io.IOException;
import java.io.InputStream;
/**
* Author: libin.chen@qunar.com Date: 14-6-5 21:02
*/
public class SystemDemo05 {
public static void main(String[] args) throws IOException {
InputStream inputStream = System.in;
StringBuffer stringBuffer = new StringBuffer();
System.out.println("请输入内容 : ");
int temp = 0;
while <strong>((temp = inputStream.read()) != -1) {</strong>
char c = (char)temp;
if (c == '\n') break;
stringBuffer.append(c);
}
System.out.println("输出的内容是 : " + stringBuffer);
inputStream.close();
System.out.println(System.getProperty("file.encoding"));
}
}
InputStream 的另一种方式读
转载于:https://www.cnblogs.com/robbychan/p/3786492.html