除了 BufferedReader br=new BufferedReader(
new InputStreamReader(System.in));
之外
还有什么方法 能使字节流转换为字符流?

解决方案 »

  1.   

    只有InputStreamReader和OutputStreamWriter是转换流,用其他节点流和处理流是不能转换的。
      

  2.   

    Scanner scan=new Scanner(System.in);
    int a=scan.nextInt();
    这个不是流转为字符么?
      

  3.   

    其他方法像 ByteBuffer 形式的 InputStream 不支持,只有各种 Channel 才支持,比如 FileChannel, SockChannel 等。然后通过 ByteBuffer 转换成 CharBuffer 就可以得到字符了。