NIO Performance Improvement compared to traditional IO in Java

后端 未结 10 821
梦谈多话
梦谈多话 2020-12-04 16:13

I have seen many articles/blogs saying that Java NIO is a better solution compared to traditional Java IO.

But today one of my co-worker showed me this blog http://m

10条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-04 16:27

    Java IO encomapsses several constructs and classes. You cannot compare on such general level. Specifically , NIO uses memory mapped files for reading - This is theoretically expected to be slightly faster than a simple BufferedInputStream file reading. However , if you compare something like a RandomAccess file read , then NIO memory mapped file will be a lot faster.

提交回复
热议问题