76
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:
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:
Package | Purpose |
---|---|
java.nio | It is top-level package for NIO system. The various types of buffers are encapsulated by this NIO system. |
java.nio.charset | It encapsulates the character sets and also supports encoders and decoders operation that convert characters to bytes and bytes to characters, respectively. |
java.nio.charset.spi | It supports the service provider for character sets. |
java.nio.channels | It support the channel, which are essentially open the I/O connections. |
java.nio.channels.spi | It supports the service providers for channels. |
java.nio.file | It provides the support for files. |
java.nio.file.spi | It supports the service providers for file system. |
java.nio.file.attribute | It provides the support for file attributes. |
Next TopicJava NIO vs IO