Skip to content

Most visited

Recently visited

navigation
Added in API level 1

InterruptibleChannel

public interface InterruptibleChannel
implements Channel

java.nio.channels.InterruptibleChannel
Known Indirect Subclasses


Channels that implement this interface can be asynchronously closed and interrupted.

A channel that can be asynchronously closed permits that a thread blocked on an I/O operation (the I/O thread) can be released by another thread calling the channel's close() method. The I/O thread will throw an AsynchronousCloseException and the channel will be closed.

A channel that is interruptible permits a thread blocked on an I/O operation (the I/O thread) to be interrupted by another thread (by invoking interrupt() on the I/O thread). When the I/O thread is interrupted it will throw a ClosedByInterruptException, it will have its interrupted status set and the channel will be closed. If the I/O thread attempts to make an I/O call with the interrupt status set the call will immediately fail with a ClosedByInterruptException.

Summary

Public methods

abstract void close()

Closes the channel.

Inherited methods

From interface java.nio.channels.Channel
From interface java.io.Closeable
From interface java.lang.AutoCloseable

Public methods

close

Added in API level 1
void close ()

Closes the channel.

Any threads that are blocked on I/O operations on this channel will be interrupted with an AsynchronousCloseException. Otherwise, this method behaves the same as defined in the Channel interface.

Throws
IOException if an I/O error occurs while closing the channel.
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.