Of the three
which is more preferred in real life for file I/O in Java and why?
I prefer channels for binary data to be put into file or read from and BufferedReader/Writer for String data
In these situation, it is better to use java.io way:
In these situation, it is better to use java.nio way:
You can see the following links for further information:
The answer is "It depends" - Buffered, Streaming, Blocking and Non-blocking I/O are all used for different purposes depending on what concurrency, throughput and other performance characteristics that you're after.
It should really be a matter of function rather than preference.
As you can see, the different APIs is designed for different purposes. In some use-cases there is overlap, in others only one API is fit for the purpose.
The problem with developing a "preference" for one style of I/O over another is that it leads to bad software; i.e. either code that is inefficient where I/O efficiency is needed, or overly complicated where I/O efficiency should not be a concern.