Udostępnij za pośrednictwem


SelectableChannel Class

Definition

A channel that can be multiplexed via a Selector.

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

Remarks

A channel that can be multiplexed via a Selector.

In order to be used with a selector, an instance of this class must first be registered via the #register(Selector,int,Object) register method. This method returns a new SelectionKey object that represents the channel's registration with the selector.

Once registered with a selector, a channel remains registered until it is deregistered. This involves deallocating whatever resources were allocated to the channel by the selector.

A channel cannot be deregistered directly; instead, the key representing its registration must be cancelled. Cancelling a key requests that the channel be deregistered during the selector's next selection operation. A key may be cancelled explicitly by invoking its SelectionKey#cancel() cancel method. All of a channel's keys are cancelled implicitly when the channel is closed, whether by invoking its Channel#close close method or by interrupting a thread blocked in an I/O operation upon the channel.

If the selector itself is closed then the channel will be deregistered, and the key representing its registration will be invalidated, without further delay.

A channel may be registered at most once with any particular selector.

Whether or not a channel is registered with one or more selectors may be determined by invoking the #isRegistered isRegistered method.

Selectable channels are safe for use by multiple concurrent threads.

"bm"><h2>Blocking mode</h2>

A selectable channel is either in blocking mode or in non-blocking mode. In blocking mode, every I/O operation invoked upon the channel will block until it completes. In non-blocking mode an I/O operation will never block and may transfer fewer bytes than were requested or possibly no bytes at all. The blocking mode of a selectable channel may be determined by invoking its #isBlocking isBlocking method.

Newly-created selectable channels are always in blocking mode. Non-blocking mode is most useful in conjunction with selector-based multiplexing. A channel must be placed into non-blocking mode before being registered with a selector, and may not be returned to blocking mode until it has been deregistered.

Added in 1.4.

Java documentation for java.nio.channels.SelectableChannel.

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

SelectableChannel()

Initializes a new instance of this class.

SelectableChannel(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)
IsBlocking

Indicates whether this channel is in blocking mode.

IsOpen

Returns true if this channel is open.

(Inherited from AbstractInterruptibleChannel)
IsRegistered

Indicates whether this channel is registered with at least one selector.

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.

(Inherited from AbstractInterruptibleChannel)
BlockingLock()

Retrieves the object upon which the #configureBlocking configureBlocking and #register register methods synchronize.

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
Close()

Closes this channel.

(Inherited from AbstractInterruptibleChannel)
ConfigureBlocking(Boolean)

Adjusts this channel's blocking mode.

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

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

(Inherited from AbstractInterruptibleChannel)
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.

(Inherited from AbstractInterruptibleChannel)
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)
KeyFor(Selector)

Retrieves the key representing the channel's registration with the given selector.

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)
Provider()

Returns the provider that created this channel.

Register(Selector, Operations, Object)

Registers this channel with the given selector, returning a selection key.

Register(Selector, Operations)

Registers this channel with the given selector, returning a selection key.

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)
ValidOps()

Returns an operation set identifying this channel's supported operations.

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, 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)
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)

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