Name

Channel

Synopsis

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.

java.nio.channels.Channel

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( )

Get Java in a Nutshell, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.