Java – buffered vs. unbuffered, which one is used?

Sorry, if this is repeated, but I can't find the exact answer to each type of best practice

I want to know what is the appropriate condition to define when to use BufferedReader to FileReader or bufferedinput / OutputStream to fileinput / OutputStream? What formula will always tell you what is appropriate?

Should I always use buffer?

thank you

Solution

If the stream is going to access a lot, use a buffer If you want to access relatively less and have a relatively large number of visits, use no buffer

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>