Module java.base

Interface NetworkChannel

All Superinterfaces:
AutoCloseable, Channel, Closeable
All Known Subinterfaces:
All Known Implementing Classes:
AsynchronousServerSocketChannel, AsynchronousSocketChannel, DatagramChannel, ServerSocketChannel, SocketChannel

public interface NetworkChannel extends Channel
A channel to a network socket.

A channel that implements this interface is a channel to a network socket. The bind method is used to bind the socket to a local address, the getLocalAddress method returns the address that the socket is bound to, and the setOption and getOption methods are used to set and query socket options. An implementation of this interface should specify the socket options that it supports.

The bind and setOption methods that do not otherwise have a value to return are specified to return the network channel upon which they are invoked. This allows method invocations to be chained. Implementations of this interface should specialize the return type so that method invocations on the implementation class can be chained.