< prev index next >

src/java.base/share/classes/java/nio/channels/package-info.java

Print this page




 224  * be examined in order to determine the operations for which each channel is
 225  * ready.  From each key one can retrieve the corresponding channel in order to
 226  * perform whatever I/O operations are required.
 227  *
 228  * <p> That a selection key indicates that its channel is ready for some operation
 229  * is a hint, but not a guarantee, that such an operation can be performed by a
 230  * thread without causing the thread to block.  It is imperative that code that
 231  * performs multiplexed I/O be written so as to ignore these hints when they prove
 232  * to be incorrect.
 233  *
 234  * <p> This package defines selectable-channel classes corresponding to the {@link
 235  * java.net.DatagramSocket}, {@link java.net.ServerSocket}, and {@link
 236  * java.net.Socket} classes defined in the {@link java.net} package.
 237  * Minor changes to these classes have been made in order to support sockets that
 238  * are associated with channels.  This package also defines a simple class that
 239  * implements unidirectional pipes.  In all cases, a new selectable channel is
 240  * created by invoking the static {@code open} method of the corresponding class.
 241  * If a channel needs an associated socket then a socket will be created as a side
 242  * effect of this operation.
 243  *






















 244  * <p> The implementation of selectors, selectable channels, and selection keys
 245  * can be replaced by "plugging in" an alternative definition or instance of the
 246  * {@link java.nio.channels.spi.SelectorProvider} class defined in the {@link
 247  * java.nio.channels.spi} package.  It is not expected that many developers
 248  * will actually make use of this facility; it is provided primarily so that
 249  * sophisticated users can take advantage of operating-system-specific
 250  * I/O-multiplexing mechanisms when very high performance is required.
 251  *
 252  * <p> Much of the bookkeeping and synchronization required to implement the
 253  * multiplexed-I/O abstractions is performed by the {@link
 254  * java.nio.channels.spi.AbstractInterruptibleChannel}, {@link
 255  * java.nio.channels.spi.AbstractSelectableChannel}, {@link
 256  * java.nio.channels.spi.AbstractSelectionKey}, and {@link
 257  * java.nio.channels.spi.AbstractSelector} classes in the {@link
 258  * java.nio.channels.spi} package.  When defining a custom selector provider,
 259  * only the {@link java.nio.channels.spi.AbstractSelector} and {@link
 260  * java.nio.channels.spi.AbstractSelectionKey} classes should be subclassed
 261  * directly; custom channel classes should extend the appropriate {@link
 262  * java.nio.channels.SelectableChannel} subclasses defined in this package.
 263  *




 224  * be examined in order to determine the operations for which each channel is
 225  * ready.  From each key one can retrieve the corresponding channel in order to
 226  * perform whatever I/O operations are required.
 227  *
 228  * <p> That a selection key indicates that its channel is ready for some operation
 229  * is a hint, but not a guarantee, that such an operation can be performed by a
 230  * thread without causing the thread to block.  It is imperative that code that
 231  * performs multiplexed I/O be written so as to ignore these hints when they prove
 232  * to be incorrect.
 233  *
 234  * <p> This package defines selectable-channel classes corresponding to the {@link
 235  * java.net.DatagramSocket}, {@link java.net.ServerSocket}, and {@link
 236  * java.net.Socket} classes defined in the {@link java.net} package.
 237  * Minor changes to these classes have been made in order to support sockets that
 238  * are associated with channels.  This package also defines a simple class that
 239  * implements unidirectional pipes.  In all cases, a new selectable channel is
 240  * created by invoking the static {@code open} method of the corresponding class.
 241  * If a channel needs an associated socket then a socket will be created as a side
 242  * effect of this operation.
 243  *
 244  * <p> {@link java.nio.channels.DatagramChannel},
 245  * {@link java.nio.channels.SocketChannel} and
 246  * {@link java.nio.channels.ServerSocketChannel}s can be created
 247  * with different {@link java.net.ProtocolFamily protocol families}. The standard
 248  * family types are specified in {@link java.net.StandardProtocolFamily}.
 249  *
 250  * <p> Channels for <i>Internet Protocol</i> sockets are created using the
 251  * {@link java.net.StandardProtocolFamily#INET INET} or {@link
 252  * java.net.StandardProtocolFamily#INET6 INET6} protocol families. <i>Internet
 253  * Protocol</i> sockets support network communication using TCP and UDP and are
 254  * addressed using {@link java.net.InetSocketAddress}es which encapsulate an IP
 255  * address and port number. <i>Internet Protocol</i> sockets are also the default
 256  * type created, when a protocol family is not specified in the channel factory
 257  * creation method.
 258  *
 259  * <p> Channels for <a id="unixdomain"></a><i>Unix Domain</i> sockets are created
 260  * using the {@link java.net.StandardProtocolFamily#UNIX UNIX} protocol family only.
 261  * <i>Unix Domain</i> sockets support local inter-process
 262  * communication on the same host, and are addressed using {@link
 263  * java.net.UnixDomainSocketAddress}es which encapsulate a filesystem pathname
 264  * on the local system.
 265  *
 266  * <p> The implementation of selectors, selectable channels, and selection keys
 267  * can be replaced by "plugging in" an alternative definition or instance of the
 268  * {@link java.nio.channels.spi.SelectorProvider} class defined in the {@link
 269  * java.nio.channels.spi} package.  It is not expected that many developers
 270  * will actually make use of this facility; it is provided primarily so that
 271  * sophisticated users can take advantage of operating-system-specific
 272  * I/O-multiplexing mechanisms when very high performance is required.
 273  *
 274  * <p> Much of the bookkeeping and synchronization required to implement the
 275  * multiplexed-I/O abstractions is performed by the {@link
 276  * java.nio.channels.spi.AbstractInterruptibleChannel}, {@link
 277  * java.nio.channels.spi.AbstractSelectableChannel}, {@link
 278  * java.nio.channels.spi.AbstractSelectionKey}, and {@link
 279  * java.nio.channels.spi.AbstractSelector} classes in the {@link
 280  * java.nio.channels.spi} package.  When defining a custom selector provider,
 281  * only the {@link java.nio.channels.spi.AbstractSelector} and {@link
 282  * java.nio.channels.spi.AbstractSelectionKey} classes should be subclassed
 283  * directly; custom channel classes should extend the appropriate {@link
 284  * java.nio.channels.SelectableChannel} subclasses defined in this package.
 285  *


< prev index next >