Monday, May 2, 2011

Java NIO introduction

NIO stands for New I/O.
The java.nio package was first included in the JDK 1.4 to help the programmer to write fast IO dealing programs. This package is part of JDK 1.5 and JDK 1.6 also. It provides improved performance in buffer management, scalable network and file I/O, character-set support and the regular-expression matching. The sub packages of the java.nio package are:
  1. java.nio
  2. java.nio.channels
  3. java.nio.channels.spi
  4. java.nio.charset
  5. java.nio.charset.spi
  6. java.util.regex
Here are the features of NIO API:
  1. It provides the buffers for data of primitive types
  2. It provides Charcter-set encoders and decoders
  3. The support for Perl-style pattern matching using regular expressions
  4. It introduces the Channels, which a new primitive I/O abstraction
  5. A file interface supporting locks and memory mapping
  6. Support for multiplexed, non-blocking I/O for writing scalable servers
The NIO API provides many useful abstraction classes to better programming. The useful abstraction classes are:
  1. Buffers
  2. Charsets
  3. Channels
  4. java.nio.channels.spi
Note : NIO has the same role and purpose as original I/O, but it uses a different metaphor -- block I/O.

    No comments:

    Post a Comment

    Chitika