New I/O Package

image

JDK 1.4 introduced a package called java.nio. “Nio” stands for “new I/O” (so the JDK 1.5 I/O improvements must be “even newer than new I/O”). The java.nio package and subpackages support four important features not previously well-provisioned in Java:

  • A non-blocking I/O facility for writing scalable servers

  • A file interface that supports locks and memory mapping

  • A pattern-matching facility based on Perl-style regular expressions

  • Character-set encoders and decoders

Instead of building these on top of streams or file descriptors, these features are implemented using two new concepts: buffers and channels.

The right way ...

Get Just Java™ 2 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.