Java NIO - Overview


Java.nio package was introduced in java 1.4. In contrast of java I/O in java NIO the buffer and channel oriented data flow for I/O operations is introduced which in result provide faster execution and better performance.

Also NIO API offer selectors which introduces the functionality of listen to multiple channels for IO events in asynchronous or non blocking way.In NIO the most time-consuming I/O activities including filling and draining of buffers to the operating system which increases in speed.

The central abstractions of the NIO APIs are following −

  • Buffers,which are containers for data,charsets and their associated decoders and encoders,which translate between bytes and Unicode characters.

  • Channels of various types,which represent connections to entities capable of performing I/O operations

  • Selectors and selection keys, which together with selectable channels define a multiplexed, non-blocking I/O facility.

Advertisements