- New Filesystem Interface
- Asynchronous I/O
- Completion of Socket-Channel Functionality
- Conclusion
Completion of Socket-Channel Functionality
JSR 51's DatagramChannel, ServerSocketChannel, and SocketChannel classes don't completely abstract a network socket: To bind into the channel's socket, or to get/set socket options, you have to first retrieve the peer socket by invoking each class's socket() method.
This counter-intuitive mix of socket channel and socket APIs exists because there wasn't enough time to define a full socket channel API when JSR 51 was implemented. JSR 203 overcomes this problem by introducing the new java.nio.channels.NetworkChannel interface.
NetworkChannel provides methods for binding the socket to a local address, returning the bound address, and getting/setting socket options. This interface is implemented by the synchronous and asynchronous socket classes; it's no longer necessary to invoke socket().
JSR 203 also introduces the new java.nio.channels.MulticastChannel interface, which brings support for IP multicasting to DatagramChannel and its asynchronous counterpart.
To learn more about NetworkChannel and MulticastChannel (along with other NIO.2 features), I recommend that you check out Ron Hitchens’ What's New in NIO.2 PDF document.