java.nio.channels.spi
Class AbstractInterruptibleChannel

java.lang.Object
  extended by java.nio.channels.spi.AbstractInterruptibleChannel
All Implemented Interfaces:
Closeable, Channel, InterruptibleChannel
Direct Known Subclasses:
FileChannel, SelectableChannel

public abstract class AbstractInterruptibleChannel
extends Object
implements Channel, InterruptibleChannel

Since:
1.4

Constructor Summary
protected AbstractInterruptibleChannel()
          Initializes the channel.
 
Method Summary
protected  void begin()
          Marks the beginning of an I/O operation that might block indefinitely.
 void close()
          Closes the channel.
protected  void end(boolean completed)
          Marks the end of an I/O operation that might block indefinitely.
protected abstract  void implCloseChannel()
          Closes the channel.
 boolean isOpen()
          Tells whether or not this channel is open.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractInterruptibleChannel

protected AbstractInterruptibleChannel()
Initializes the channel.

Method Detail

begin

protected final void begin()
Marks the beginning of an I/O operation that might block indefinitely.


close

public final void close()
                 throws IOException
Closes the channel.

Specified by:
close in interface Closeable
Specified by:
close in interface Channel
Specified by:
close in interface InterruptibleChannel
Throws:
IOException - If an error occurs

end

protected final void end(boolean completed)
                  throws AsynchronousCloseException
Marks the end of an I/O operation that might block indefinitely.

Parameters:
completed - true if the task completed successfully, false otherwise
Throws:
AsynchronousCloseException - If the channel was asynchronously closed.
ClosedByInterruptException - If the thread blocked in the I/O operation was interrupted.

implCloseChannel

protected abstract void implCloseChannel()
                                  throws IOException
Closes the channel.

Throws:
IOException - If an error occurs

isOpen

public final boolean isOpen()
Tells whether or not this channel is open.

Specified by:
isOpen in interface Channel
Returns:
true if the channel is open, false otherwise