|
Préférences
Moteurs de recherche
|
|||||||||||||||||||
JavaTM 2 Platform Std. Ed. v1.5.0
java.nio.channels.spi
|
Constructor Summary | |
---|---|
protected |
AbstractInterruptibleChannel()
Initializes a new instance of this class. |
Method Summary | |
---|---|
protected void |
begin()
Marks the beginning of an I/O operation that might block indefinitely. |
void |
close()
Closes this channel. |
protected void |
end(boolean completed)
Marks the end of an I/O operation that might block indefinitely. |
protected abstract void |
implCloseChannel()
Closes this 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 |
---|
protected AbstractInterruptibleChannel()
Method Detail |
---|
public final void close() throws IOException
If the channel has already been closed then this method returns
immediately. Otherwise it marks the channel as closed and then invokes
the implCloseChannel
method in order to
complete the close operation.
IOException
- If an I/O error occursprotected abstract void implCloseChannel() throws IOException
This method is invoked by the close
method in order
to perform the actual work of closing the channel. This method is only
invoked if the channel has not yet been closed, and it is never invoked
more than once.
An implementation of this method must arrange for any other thread that is blocked in an I/O operation upon this channel to return immediately, either by throwing an exception or by returning normally.
IOException
- If an I/O error occurs while closing the channelpublic final boolean isOpen()
Channel
protected final void begin()
This method should be invoked in tandem with the end
method, using a try ... finally block as
shown above, in order to implement asynchronous
closing and interruption for this channel.
protected final void end(boolean completed) throws AsynchronousCloseException
This method should be invoked in tandem with the begin
method, using a try ... finally block
as shown above, in order to implement asynchronous
closing and interruption for this channel.
completed
- true if, and only if, the I/O operation completed
successfully, that is, had some effect that would be visible to
the operation's invoker
AsynchronousCloseException
- If the channel was asynchronously closed
ClosedByInterruptException
- If the thread blocked in the I/O operation was interrupted