Java In A Nutshell, 5th Edition

Channel java.nio.channels

Java 1.4 closeable

This interface defines a communication channel for input and output. The Channel interface is a high-level generic interface which is extended by more specific interfaces, such as ReadableByteChannel and WritableByteChannel . Channel defines only two methods : isOpen( ) determines whether a channel is open , and close( ) closes a channel. Channels are open when they are first created. Once closed, a channel remains closed forever, and no further I/O operations may take place through it.

Many channel implementations are interruptible and asynchonously closeable, and implement the InterruptibleChannel interface to advertise this fact. See InterruptibleChannel for details.

Figure 13-17. java.nio.channels.Channel

public interface Channel extends java.io.Closeable { // Public Instance Methods void close ( ) throws java.io.IOException; boolean isOpen ( ); }

Implementations

InterruptibleChannel , ReadableByteChannel , SelectableChannel , WritableByteChannel , java.nio.channels.spi.AbstractInterruptibleChannel

Returned By

System.inheritedChannel( ) , java.nio.channels.spi.SelectorProvider.inheritedChannel( )

Категории