Java NIO Tutorial

Last modified on August 20th, 2015 by Joe.

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.

Java-NIO

Difference between Standard IO and NIO

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.

Java NIO

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.

Comments on "Java NIO Tutorial"

  1. […] tutorial is part of the Java NIO tutorial series. In this tutorial, we will see about what is a Path and a File with respect to Java NIO. […]

  2. Firoz Shaikh says:

    Waiting for new ideas on core java from your side…

  3. srikanth says:

    Good start on NIO , Joseph. Expecting many more to come. Thanks!!

  4. Joe says:

    @Srikanth,

    Thanks party. Sure, planning to cover NIO in the coming days.

  5. […] tutorial is part of Java NIO tutorial series. In this tutorial, let us get introduced to Files class from java.nio.file package, it […]

  6. Kumaresh Babu says:

    Hello Sir,
    These tutorials are good and nice. Easy to understand the concepts.

  7. […] through what a glob is and how to use it with Java. This tutorial is part of the currently on going Java NIO tutorials […]

  8. Viddya Sagar says:

    Thanks Sir,

    It’s nice tutorial for starting with NIO.

  9. […] this tutorial, I will walk you through writing a TFTP client using Java NIO. This is part of the Java NIO tutorials series. This tutorial will help you understand DatagramChannel, Selector, Path, Paths and Files Java NIO […]

  10. […] seamless less access to the attributes and a way of manipulating them. This tutorial is part of the Java NIO tutorial […]

  11. […] Java tutorial is to learn about handling file using Java NIO. This tutorial is part of the Java NIO tutorial series. We will see about basic file operations like how to delete, copy, move a file and […]

  12. […] let us learn about putting FileVisitor and glob pattern matching into practical use. In the present Java NIO tutorial series we learnt about what is glob and how to use it. Then we saw about how to walk a file tree […]

  13. […] FileVisitor interface using which we can walk through a file tree. This tutorial is part of the Java NIO tutorial […]

  14. […] and FileChannel to perform file IO operations. Just wanted to remind you, I am publishing a Java NIO tutorial series and this tutorial is part of it. Go through the NIO Channel tutorial to know more about NIO […]

Comments are closed for "Java NIO Tutorial".