public interface Channel extends Closeable
Channels are open upon creation, and can be closed explicitly. Once a channel
is closed it cannot be re-opened, and any attempts to perform I/O operations
on the closed channel result in a ClosedChannelException
.
Particular implementations or sub-interfaces of Channel
dictate
whether they are thread-safe or not.
boolean isOpen()
void close() throws IOException
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 attempt to simultaneously close a channel, then only one thread will run the closure code, and others will be blocked until the first returns.
close
in interface AutoCloseable
close
in interface Closeable
IOException
- if a problem occurs closing the channel.