# InterruptibleChannel

public interface **InterruptibleChannel** implements [Channel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/Channel.html)

|---|---|---|
| Known Indirect Subclasses [AbstractInterruptibleChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/spi/AbstractInterruptibleChannel.html), [AbstractSelectableChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/spi/AbstractSelectableChannel.html), [DatagramChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/DatagramChannel.html), [FileChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/FileChannel.html), [Pipe.SinkChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/Pipe.SinkChannel.html), [Pipe.SourceChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/Pipe.SourceChannel.html), [SelectableChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/SelectableChannel.html), [ServerSocketChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/ServerSocketChannel.html), [SocketChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/SocketChannel.html) |---|---| | [AbstractInterruptibleChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/spi/AbstractInterruptibleChannel.html) | Base implementation class for interruptible channels. | | [AbstractSelectableChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/spi/AbstractSelectableChannel.html) | Base implementation class for selectable channels. | | [DatagramChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/DatagramChannel.html) | A selectable channel for datagram-oriented sockets. | | [FileChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/FileChannel.html) | A channel for reading, writing, mapping, and manipulating a file. | | [Pipe.SinkChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/Pipe.SinkChannel.html) | A channel representing the writable end of a `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/Pipe.html`. | | [Pipe.SourceChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/Pipe.SourceChannel.html) | A channel representing the readable end of a `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/Pipe.html`. | | [SelectableChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/SelectableChannel.html) | A channel that can be multiplexed via a `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/Selector.html`. | | [ServerSocketChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/ServerSocketChannel.html) | A selectable channel for stream-oriented listening sockets. | | [SocketChannel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/SocketChannel.html) | A selectable channel for stream-oriented connecting sockets. | |||

A channel that can be asynchronously closed and interrupted.

A channel that implements this interface is *asynchronously closeable:* If a thread is blocked in an I/O operation on an
interruptible channel then another thread may invoke the channel's `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/InterruptibleChannel.html#close()` method. This will cause the blocked thread to receive an
`https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/AsynchronousCloseException.html`.

A channel that implements this interface is also *interruptible:*
If a thread is blocked in an I/O operation on an interruptible channel then
another thread may invoke the blocked thread's `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Thread.html#interrupt()` method. This will cause the channel to be closed, the blocked
thread to receive a `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/ClosedByInterruptException.html`, and the blocked
thread's interrupt status to be set.

If a thread's interrupt status is already set and it invokes a blocking
I/O operation upon a channel then the channel will be closed and the thread
will immediately receive a `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/ClosedByInterruptException.html`; its interrupt
status will remain set.

A channel supports asynchronous closing and interruption if, and only
if, it implements this interface. This can be tested at runtime, if
necessary, via the instanceof operator.

### Public Method Summary

|---|---|
| abstract void | [close](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/InterruptibleChannel.html#close())() Closes this channel. |

### Inherited Method Summary

From interface [java.nio.channels.Channel](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/Channel.html)

|---|---|
| abstract void | [close](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/Channel.html#close())() Closes this channel. |
| abstract boolean | [isOpen](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/Channel.html#isOpen())() Tells whether or not this channel is open. |

From interface [java.io.Closeable](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/Closeable.html)

|---|---|
| abstract void | [close](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/Closeable.html#close())() Closes this stream and releases any system resources associated with it. |

From interface [java.lang.AutoCloseable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/AutoCloseable.html)

|---|---|
| abstract void | [close](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/AutoCloseable.html#close())() Closes this resource, relinquishing any underlying resources. |

## Public Methods

#### public abstract void
**close**
()

Closes this channel.

Any thread currently blocked in an I/O operation upon this channel
will receive an `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/AsynchronousCloseException.html`.

This method otherwise behaves exactly as specified by the `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/Channel.html#close()` interface.

<br />

##### Throws

| [IOException](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/IOException.html) | If an I/O error occurs |
|---|---|