ClosedChannelException

  • ClosedChannelException signals an attempt to perform an I/O operation on a channel that is closed, either entirely or for the specific operation.

  • It's a checked exception, meaning it must be handled during compilation or declared in the method signature.

  • While indicating a closed channel, it doesn't necessarily mean the channel is fully closed; parts might still be open for other operations (e.g., a socket channel closed for writing could be open for reading).

  • This exception inherits from IOException and has direct subclasses like AsynchronousCloseException and indirect ones like ClosedByInterruptException, providing more specific closure contexts.

  • It has a public constructor with no parameters to create instances of this exception.

public class ClosedChannelException extends IOException
Known Direct Subclasses
Known Indirect Subclasses

Checked exception thrown when an attempt is made to invoke or complete an I/O operation upon channel that is closed, or at least closed to that operation. That this exception is thrown does not necessarily imply that the channel is completely closed. A socket channel whose write half has been shut down, for example, may still be open for reading.

Public Constructor Summary

ClosedChannelException()
Constructs an instance of this class.

Inherited Method Summary

Public Constructors

public ClosedChannelException ()

Constructs an instance of this class.