阅读内容:
interface chanel
A nexus for I/O operations.
I/O操作的连接。
A channel represents an open connection to an entity such as a hardware device, a file, a network socket, or a program component that is capable of performing one or more distinct I/O operations, for example reading or writing.
Chanel表示打开一个连接如硬件、文件、网络套接字或程序组件执行一个或多个不同的I/O操作,例如读取或写入。
A channel is either open or closed. A channel is open upon creation, and once closed it remains closed. Once a channel is closed, any attempt to invoke an I/O operation upon it will cause a {@link ClosedChannelException} to be thrown. Whether or not a channel is open may be tested by invoking its {@link #isOpen isOpen} method.
通道要么是打开的,要么是关闭的。通道在创建时是打开的,一旦关闭,它就会保持关闭的状态。一旦通道关闭,任何对其调用I/O操作的尝试都会引发{@link ClosedChannelException}。通道是否打开可以通过调用其{@link #isOpen isOpen}方法进行测试。
Channels are, in general, intended to be safe for multithreaded access as described in the specifications of the interfaces and classes that extend and implement this interface.
一般来说,通道是用于多线程访问的,就像扩展和实现该接口的接口和类的规范中描述的那样。
interface NetworkChanel extend chanel
A channel to a network socket.
网络套接字的Chanel。
A channel that implements this interface is a channel to a network socket. The {@link#bind(SocketAddress) bind} method is used to bind the socket to a local {@link SocketAddress address}, the {@link #getLocalAddress() getLocalAddress} method returns the address that the socket is bound to, and the {@link #setOption(SocketOption,Object) setOption} and {@link #getOption(SocketOption) getOption} methods are used to set and query socket options. An implementation of this interface should specify the socket options that it supports.
实现此接口的通道是到网络套接字的通道。{@link#bind(SocketAddress) bind}方法用于将套接字绑定到本地的{@link SocketAddress address}, {@link# getLocalAddress() getLocalAddress}方法返回套接字绑定到的地址,{@link# setOption(SocketOption,Object) setOption}和{@link# getOption(SocketOption) getOption}方法用于设置和查询套接字选项。这个接口的实现应该说明它支持的套接字选项。
The {@link #bind bind} and {@link #setOption 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.
没有返回值的{@link #bind}和{@link #setOption}方法被指定为返回调用它们的网络通道。这允许方法调用被链接。该接口的实现应该专门化返回类型,以便可以链接对实现类的方法调用。
我的疑问: