Question: Is it true that java.nio
package name (I mean NIO part) means "New
If so, why it was named like this?
Answer: Yes, NIO stands for "New
Input/Output". These APIs - which were added to the
J2SETM platform in Version 1.4 - are designed to boost
performance of I/O operations in Java applications.
The APIs also provide several features for things like
regular expression handling and character-set conversion.
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 java.io package.
The NIO APIs include the following features:
- The scalable I/O API will make it easier to write production-quality web
and application servers that scale well to thousands
of open connections and can easily take advantage of
- The fast buffered binary I/O API will make it easier to write
high-performance, I/O-intensive programs that manipulate
streams or files of binary data;
- The fast buffered character I/O API will simplify the efficient
handling of character streams and files; it will also bring
regular expressions and a compact notation for formatted output
to the Java platform, putting it on a par with other popular platforms
such as Perl;
- The character-set converter API will give developers direct access the
platform's built-in character-set converters and will also provide for the
easy "plugging in" of new converters;
- The new set of I/O exceptions will make it easier to write programs that
recover from different types of I/O failures in
different ways, and to write user interfaces that behave consistently on
different platforms when I/O failures occur;
- The new filesystem interface will work more consistently across
platforms, will make it easier to write programs that gracefully handle
the failure of filesystem operations, will provide
more efficient access to a larger set of file attributes, will allow
developers of sophisticated applications to take
advantage of platform-specific features when absolutely
necessary, and will allow support for non-native filesystems, such as
network filesystems, to be "plugged in" to the platform.
You could ask: Why were not these needs met by older APIs? Yes it
was possible, but it took much time to write custom code...
The new API makes this kind of work unnecessary!
This tip is based on SUN's documentation taken from
36 comments | | Score: 4.5