AbstractInterruptibleChannel Class

Definition

Base implementation class for interruptible channels.

[Android.Runtime.Register("java/nio/channels/spi/AbstractInterruptibleChannel", DoNotGenerateAcw=true)]
public abstract class AbstractInterruptibleChannel : Java.Lang.Object, IDisposable, Java.Interop.IJavaPeerable, Java.Nio.Channels.IInterruptibleChannel
[<Android.Runtime.Register("java/nio/channels/spi/AbstractInterruptibleChannel", DoNotGenerateAcw=true)>]
type AbstractInterruptibleChannel = class
    inherit Object
    interface IChannel
    interface ICloseable
    interface IJavaObject
    interface IDisposable
    interface IJavaPeerable
    interface IInterruptibleChannel
Inheritance
AbstractInterruptibleChannel
Derived
Attributes
Implements

Remarks

Base implementation class for interruptible channels.

This class encapsulates the low-level machinery required to implement the asynchronous closing and interruption of channels. A concrete channel class must invoke the #begin begin and #end end methods before and after, respectively, invoking an I/O operation that might block indefinitely. In order to ensure that the #end end method is always invoked, these methods should be used within a try&nbsp;...&nbsp;finally block:

<blockquote>

boolean completed = false;
            try {
                begin();
                completed = ...;    // Perform blocking I/O operation
                return ...;         // Return result
            } finally {
                end(completed);
            }

</blockquote>

The completed argument to the #end end method tells whether or not the I/O operation actually completed, that is, whether it had any effect that would be visible to the invoker. In the case of an operation that reads bytes, for example, this argument should be true if, and only if, some bytes were actually transferred into the invoker's target buffer.

A concrete channel class must also implement the #implCloseChannel implCloseChannel method in such a way that if it is invoked while another thread is blocked in a native I/O operation upon the channel then that operation will immediately return, either by throwing an exception or by returning normally. If a thread is interrupted or the channel upon which it is blocked is asynchronously closed then the channel's #end end method will throw the appropriate exception.

This class performs the synchronization required to implement the java.nio.channels.Channel specification. Implementations of the #implCloseChannel implCloseChannel method need not synchronize against other threads that might be attempting to close the channel.

Added in 1.4.

Java documentation for java.nio.channels.spi.AbstractInterruptibleChannel.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Constructors

AbstractInterruptibleChannel()

Initializes a new instance of this class.

AbstractInterruptibleChannel(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

Properties

Class

Returns the runtime class of this Object.

(Inherited from Object)
Handle

The handle to the underlying Android instance.

(Inherited from Object)
IsOpen

Returns true if this channel is open.

JniIdentityHashCode (Inherited from Object)
JniPeerMembers
PeerReference (Inherited from Object)
ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Methods

Begin()

Marks the beginning of an I/O operation that might block indefinitely.

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
Close()

Closes this channel.

Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
End(Boolean)

Marks the end of an I/O operation that might block indefinitely.

Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
ImplCloseChannel()

Closes this channel.

JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to