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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.