Java NIO

02/04/06 Permalink

What are the key differences between Java NIO and the traditional Java IO?

Here's a brief overview from the java.sun site:

The new I/O (NIO) APIs introduced in v 1.4 provide new features and improved performance in the areas of buffer management, scalable network and file I/O, character-set support, and regular-expression matching. The NIO APIs supplement the I/O facilities in the package.

Looking into it, you'll see that one of the main extras is that Channels have been integrated into the input-output. These channels allow from better flexibility and control of the operation of I/O streams. They facilitate non-blocking capabilities on streams thus increasing efficiency through using less resources.

There's a lot of other stuff like File locking, better memory I/O through JNI and byte mapping, and easier character decoding.


  • Oreilly article on Java NIO.
  • There's a Java.sun article here.
  • A brief Java NIO summary.
  • Javaworld practical example building a server here.
    Share It: Digg | | Furl | reddit | Facebook | Yahoo! | Send to Phone | Feedback