开发者社区 问答 正文

JAVA中字节流转成字符流如何理解?

JAVA中字节流转成字符流如何理解?

展开
收起
vncamyi27xznk 2021-11-15 21:51:07 438 分享 版权
1 条回答
写回答
取消 提交回答
  • "console.log(1) public static void main(String[] args) throws IOException { File f = new File(""test.txt""); InputStreamReader inr = new InputStreamReader(new FileInputStream(f), ""UTF-8""); char[] buf = new char[1024]; int len = inr.read(buf); System.out.println(new String(buf,0,len)); inr.close(); }

    资料来源:《Java工程师成神之路(基础篇)》,链接:https://developer.aliyun.com/topic/download?id=923"

    2021-11-15 23:43:47
    赞同 展开评论