Build 1.0_r1(from source)

Interface Channel

All Superinterfaces:
All Known Subinterfaces:
ByteChannel, GatheringByteChannel, InterruptibleChannel, ReadableByteChannel, ScatteringByteChannel, WritableByteChannel
All Known Implementing Classes:
AbstractInterruptibleChannel, AbstractSelectableChannel, DatagramChannel, FileChannel, Pipe.SinkChannel, Pipe.SourceChannel, SelectableChannel, ServerSocketChannel, SocketChannel

public interface Channel
extends Closeable

A channel is a conduit to IO services covering such items as files, sockets, hardware devices, IO ports, or some software component.

Channels are open upon creation, and can be explicitly closed. Once a channel is closed it cannot be re-opened, and attempts to perform IO operations on the closed channel result in a ClosedChannelException .

Particular implementations or sub-interfaces of Channel dictate whether they are thread-safe or not.

Method Summary
 void close()
          Closes an open channel.
 boolean isOpen()
          Returns whether this channel is open or not.

Method Detail


boolean isOpen()
Returns whether this channel is open or not.

true if the channel is open, otherwise returns false.


void close()
           throws IOException
Closes an open channel. If the channel is already closed this method has no effect. If there is a problem with closing the channel then the method throws an IOException and the exception contains reasons for the failure.

If an attempt is made to perform an operation on a closed channel then a ClosedChannelException will be thrown on that attempt.

If multiple threads attempts to simultaneously close a channel, then only one thread will run the closure code, and others will be blocked until the first returns.

Specified by:
close in interface Closeable
IOException - if a problem occurs closing the channel.

Build 1.0_r1(from source)

Please submit a feedback, bug or feature