Skip to content

Most visited

Recently visited

navigation
Added in API level 1

SelectorProvider

public abstract class SelectorProvider
extends Object

java.lang.Object
   ↳ java.nio.channels.spi.SelectorProvider


SelectorProvider is an abstract base class that declares methods for providing instances of DatagramChannel, Pipe, Selector , ServerSocketChannel, and SocketChannel. All the methods of this class are thread-safe.

A provider instance can be retrieved through a system property or the configuration file in a jar file; if no provider is available that way then the system default provider is returned.

Summary

Protected constructors

SelectorProvider()

Constructs a new SelectorProvider.

Public methods

Channel inheritedChannel()

Returns the channel inherited from the process that created this VM.

abstract DatagramChannel openDatagramChannel()

Creates a new open DatagramChannel.

abstract Pipe openPipe()

Creates a new Pipe.

abstract AbstractSelector openSelector()

Creates a new selector.

abstract ServerSocketChannel openServerSocketChannel()

Creates a new open ServerSocketChannel.

abstract SocketChannel openSocketChannel()

Create a new open SocketChannel.

static SelectorProvider provider()

Gets a provider instance by executing the following steps when called for the first time:

  • if the system property "java.nio.channels.spi.SelectorProvider" is set, the value of this property is the class name of the provider returned;
  • if there is a provider-configuration file named "java.nio.channels.spi.SelectorProvider" in META-INF/services of a jar file valid in the system class loader, the first class name is the provider's class name;
  • otherwise, a system default provider will be returned.

Inherited methods

From class java.lang.Object

Protected constructors

SelectorProvider

Added in API level 1
SelectorProvider ()

Constructs a new SelectorProvider.

Public methods

inheritedChannel

Added in API level 1
Channel inheritedChannel ()

Returns the channel inherited from the process that created this VM. On Android, this method always returns null because stdin and stdout are never connected to a socket.

Returns
Channel the channel.
Throws
IOException if an I/O error occurs.

openDatagramChannel

Added in API level 1
DatagramChannel openDatagramChannel ()

Creates a new open DatagramChannel.

Returns
DatagramChannel the new channel.
Throws
IOException if an I/O error occurs.

openPipe

Added in API level 1
Pipe openPipe ()

Creates a new Pipe.

Returns
Pipe the new pipe.
Throws
IOException if an I/O error occurs.

openSelector

Added in API level 1
AbstractSelector openSelector ()

Creates a new selector.

Returns
AbstractSelector the new selector.
Throws
IOException if an I/O error occurs.

openServerSocketChannel

Added in API level 1
ServerSocketChannel openServerSocketChannel ()

Creates a new open ServerSocketChannel.

Returns
ServerSocketChannel the new channel.
Throws
IOException if an I/O error occurs.

openSocketChannel

Added in API level 1
SocketChannel openSocketChannel ()

Create a new open SocketChannel.

Returns
SocketChannel the new channel.
Throws
IOException if an I/O error occurs.

provider

Added in API level 1
SelectorProvider provider ()

Gets a provider instance by executing the following steps when called for the first time:

  • if the system property "java.nio.channels.spi.SelectorProvider" is set, the value of this property is the class name of the provider returned;
  • if there is a provider-configuration file named "java.nio.channels.spi.SelectorProvider" in META-INF/services of a jar file valid in the system class loader, the first class name is the provider's class name;
  • otherwise, a system default provider will be returned.

Returns
SelectorProvider the provider.
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.