package mooc;
import java.io.IOException;
/*
* 回车汉子代表两个字节,一个字符
*/
public class stream {
public static void main(String[] args){
System.out.println("Hello world");
byte[] buffer = new byte[1024];
try {
int len = System.in.read(buffer);
String s = new String(buffer,0,len);
System.out.println("读到了多少字节"+len);
System.out.println(s);
System.out.println("s的长度是"+s.length());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
package mooc;
import java.io.IOException;
/