Java NIO Package

The NIO classes are contained in a package called java.nio package. It is important to understand that the NIO subsystem does not replace the stream based I/O classes available in java.io package, and good working knowledge of stream-based I/O in java.io is helpful for understanding NIO.

The important NIO classes grouped under different categories are shown below:

Java Nio tutorial5

The above groups are based on what is the use of NIO classes from developer point of view. The purpose behind this grouping is the representation of file system or the level of interaction with file system.

The NIO classes are contained in the packages as given below:

PackagePurpose
java.nioIt is top-level package for NIO system. The various types of buffers are encapsulated by this NIO system.
java.nio.charsetIt encapsulates the character sets and also supports encoders and decoders operation that convert characters to bytes and bytes to characters, respectively.
java.nio.charset.spiIt supports the service provider for character sets.
java.nio.channelsIt support the channel, which are essentially open the I/O connections.
java.nio.channels.spiIt supports the service providers for channels.
java.nio.fileIt provides the support for files.
java.nio.file.spiIt supports the service providers for file system.
java.nio.file.attributeIt provides the support for file attributes.
Next TopicJava NIO vs IO




Latest Courses