I am starting a Java tutorial series on NIO. This is the first article and will serve as table of contents for the tutorial series. NIO was introduced in Java for buffer oriented and non blocking IO operations. Before that in Java we had only the standard IO based on streams and blocking IO operations.
First main difference between the standard IO and NIO is, standard IO is based on streams and NIO is buffer oriented. Buffer oriented operations provide as flexibility in handling data. In buffer oriented NIO, data is first read into a buffer and then it is made available for processing. So we can move back and forth in the buffer. But in the case of streams it is not possible.
Second main difference is, blocking and non-blocking IO operations. In case of streams, a thread will be blocked until it completes the IO operation. Wherein the NIO allows for non-blocking operations. If the data is not available for IO operations, then the thread can do something else and need not stay in blocked mode. With channels and selectors a single thread can manage multiple threads and parallel IO operations.
As part of this Java NIO tutorial series, I will be covering the following topics. If you need any other topics to be covered as part of this tutorials, please add your comment.
This Java tutorial was added on 18/05/2015.