Top Description Fields Constructors Methods
org.newsclub.net.unix

public abstract Class AFSelectorProvider<A extends AFSocketAddress>

extends SelectorProviderShim
Class Inheritance
Known Direct Subclasses
org.newsclub.net.unix.AFUNIXSelectorProvider, org.newsclub.net.unix.AFGenericSelectorProvider
Type Parameters
<A>
The concrete AFSocketAddress that is supported by this type.
Imports
java.io.IOException, java.net.ProtocolFamily, .SocketAddress, .StandardProtocolFamily, java.nio.channels.DatagramChannel, .Pipe, .ServerSocketChannel, .SocketChannel, java.nio.channels.spi.AbstractSelector, .SelectorProvider, java.util.Objects, org.eclipse.jdt.annotation.NonNull

Service-provider class for junixsocket selectors and selectable channels.

Field Summary

Modifier and TypeField and Description
private static final SelectorProvider

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
protected abstract AFAddressFamily<@NonNull A>

Returns:

The address family.
addressFamily
()

Returns the address family supported by this implementation.

protected final int

Returns:

The domain ID.
domainId
()

Returns the domain ID for the supported protocol, as specified by NativeUnixSocket.

private AFPipe

Returns:

The pipe.
newPipe
(boolean
true if the pipe should be selectable.
selectable
)

Constructs a new pipe.

protected abstract AFSocket<A>

Returns:

The socket instance.
newSocket
()

Constructs a new socket.

protected abstract <
The type of the pair.
Y extends AFSomeSocket
>
AFSocketPair<Y>

Returns:

The pair.
newSocketPair
(Y
Some socket, the first one.
s1
,
Y
Some socket, the second one.
s2
)

Constructs a new socket pair from two sockets.

public abstract AFDatagramChannel<A>
public abstract AFDatagramChannel<A>

Returns:

the new channel
openDatagramChannel
(AFSocketType
The socket type.
type
)

Opens a DatagramChannel using the given socket type.

public AFDatagramChannel<A>
openDatagramChannel(ProtocolFamily
The protocol family
family
)

Implements abstract java.nio.channels.spi.SelectorProvider.openDatagramChannel.

Opens a datagram channel.

public AFSocketPair<? extends AFDatagramChannel<A>>

Returns:

The new channel pair.
openDatagramChannelPair
()

Opens a socket pair of interconnected datagram channels.

public AFSocketPair<? extends AFDatagramChannel<A>>

Returns:

The new channel pair.
openDatagramChannelPair
(AFSocketType
The socket type.
type
)

Opens a socket pair of interconnected DatagramChannels, using the given AFSocketType.

public final AFPipe
openPipe()

Implements abstract java.nio.channels.spi.SelectorProvider.openPipe.

Opens a pipe.

pack-priv final AFPipe

Returns:

The new pipe
openSelectablePipe
()

Opens a pipe with support for selectors.

public final AbstractSelector
openSelector()

Implements abstract java.nio.channels.spi.SelectorProvider.openSelector.

Opens a selector.

public abstract AFServerSocketChannel<A>
public abstract AFServerSocketChannel<A>

Returns:

The new channel
openServerSocketChannel
(SocketAddress
The socket address to bind on.
sa
)

Opens a server-socket channel bound on the given SocketAddress.

public AFServerSocketChannel<A>
openServerSocketChannel(ProtocolFamily
The protocol family
family
)

Overrides java.nio.channels.spi.SelectorProvider.openServerSocketChannel.

Opens a server-socket channel.

public AFSocketChannel<A>
public abstract AFSocketChannel<A>

Returns:

The new channel
openSocketChannel
(SocketAddress
The socket address to connect to.
sa
)

Opens a socket channel connected to the given SocketAddress.

public AFSocketChannel<A>
openSocketChannel(ProtocolFamily
The protocol family
family
)

Overrides java.nio.channels.spi.SelectorProvider.openSocketChannel.

Opens a socket channel.

public AFSocketPair<? extends AFSocketChannel<A>>

Returns:

The new channel pair.
openSocketChannelPair
()

Opens a socket pair of interconnected channels.

protected abstract ProtocolFamily

Returns:

The protocol family.
protocolFamily
()

Returns the protocol family supported by this implementation.

public static SelectorProvider

Returns:

The instance.
provider
()

Hides java.nio.channels.spi.SelectorProvider.provider.

Returns the singleton instance for an "fallback" provider that supports the methods taking ProtocolFamily, as long as a junixsocket-specific AFProtocolFamily is used.

Field Detail

AF_PROVIDERback to summary
private static final SelectorProvider AF_PROVIDER

Constructor Detail

AFSelectorProviderback to summary
protected AFSelectorProvider()

Constructs a new AFSelectorProvider.

Method Detail

addressFamilyback to summary
protected abstract AFAddressFamily<@NonNull A> addressFamily()

Returns the address family supported by this implementation.

Returns:AFAddressFamily<@NonNull A>

The address family.

domainIdback to summary
protected final int domainId()

Returns the domain ID for the supported protocol, as specified by NativeUnixSocket.

Returns:int

The domain ID.

newPipeback to summary
private AFPipe newPipe(boolean selectable) throws IOException

Constructs a new pipe.

Parameters
selectable:boolean

true if the pipe should be selectable.

Returns:AFPipe

The pipe.

Exceptions
IOException:
on error.
newSocketback to summary
protected abstract AFSocket<A> newSocket() throws IOException

Constructs a new socket.

Returns:AFSocket<A>

The socket instance.

Exceptions
IOException:
on error.
newSocketPairback to summary
protected abstract <Y extends AFSomeSocket> AFSocketPair<Y> newSocketPair(Y s1, Y s2)

Constructs a new socket pair from two sockets.

Parameters
<Y>
The type of the pair.
s1:Y

Some socket, the first one.

s2:Y

Some socket, the second one.

Returns:AFSocketPair<Y>

The pair.

openDatagramChannelback to summary
public abstract AFDatagramChannel<A> openDatagramChannel() throws IOException

Implements abstract java.nio.channels.spi.SelectorProvider.openDatagramChannel.

Doc from java.nio.channels.spi.SelectorProvider.openDatagramChannel.

Opens a datagram channel.

Returns:AFDatagramChannel<A>

The new channel

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs
openDatagramChannelback to summary
public abstract AFDatagramChannel<A> openDatagramChannel(AFSocketType type) throws IOException

Opens a DatagramChannel using the given socket type.

Parameters
type:AFSocketType

The socket type.

Returns:AFDatagramChannel<A>

the new channel

Exceptions
IOException:
on error.
openDatagramChannelback to summary
public AFDatagramChannel<A> openDatagramChannel(ProtocolFamily family) throws IOException

Implements abstract java.nio.channels.spi.SelectorProvider.openDatagramChannel.

Doc from java.nio.channels.spi.SelectorProvider.openDatagramChannel.

Opens a datagram channel.

Parameters
family:ProtocolFamily

The protocol family

Returns:AFDatagramChannel<A>

A new datagram channel

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs
openDatagramChannelPairback to summary
public AFSocketPair<? extends AFDatagramChannel<A>> openDatagramChannelPair() throws IOException

Opens a socket pair of interconnected datagram channels.

Returns:AFSocketPair<? extends AFDatagramChannel<A>>

The new channel pair.

Exceptions
IOException:
on error.
openDatagramChannelPairback to summary
public AFSocketPair<? extends AFDatagramChannel<A>> openDatagramChannelPair(AFSocketType type) throws IOException

Opens a socket pair of interconnected DatagramChannels, using the given AFSocketType.

Parameters
type:AFSocketType

The socket type.

Returns:AFSocketPair<? extends AFDatagramChannel<A>>

The new channel pair.

Annotations
@SuppressWarnings:resource
Exceptions
IOException:
on error.
openPipeback to summary
public final AFPipe openPipe() throws IOException

Implements abstract java.nio.channels.spi.SelectorProvider.openPipe.

Doc from java.nio.channels.spi.SelectorProvider.openPipe.

Opens a pipe.

Returns:AFPipe

The new pipe

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs
openSelectablePipeback to summary
pack-priv final AFPipe openSelectablePipe() throws IOException

Opens a pipe with support for selectors.

Returns:AFPipe

The new pipe

Exceptions
IOException:
on error.
openSelectorback to summary
public final AbstractSelector openSelector() throws IOException

Implements abstract java.nio.channels.spi.SelectorProvider.openSelector.

Doc from java.nio.channels.spi.SelectorProvider.openSelector.

Opens a selector.

Returns:AbstractSelector

The new selector

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs
openServerSocketChannelback to summary
public abstract AFServerSocketChannel<A> openServerSocketChannel() throws IOException

Implements abstract java.nio.channels.spi.SelectorProvider.openServerSocketChannel.

Doc from java.nio.channels.spi.SelectorProvider.openServerSocketChannel.

Opens a server-socket channel.

Returns:AFServerSocketChannel<A>

The new channel

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs
openServerSocketChannelback to summary
public abstract AFServerSocketChannel<A> openServerSocketChannel(SocketAddress sa) throws IOException

Opens a server-socket channel bound on the given SocketAddress.

Parameters
sa:SocketAddress

The socket address to bind on.

Returns:AFServerSocketChannel<A>

The new channel

Exceptions
IOException:
on error.
openServerSocketChannelback to summary
public AFServerSocketChannel<A> openServerSocketChannel(ProtocolFamily family) throws IOException

Overrides java.nio.channels.spi.SelectorProvider.openServerSocketChannel.

Doc from java.nio.channels.spi.SelectorProvider.openServerSocketChannel.

Opens a server-socket channel.

Parameters
family:ProtocolFamily

The protocol family

Returns:AFServerSocketChannel<A>

The new channel

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs
openSocketChannelback to summary
public AFSocketChannel<A> openSocketChannel() throws IOException

Implements abstract java.nio.channels.spi.SelectorProvider.openSocketChannel.

Doc from java.nio.channels.spi.SelectorProvider.openSocketChannel.

Opens a socket channel.

Returns:AFSocketChannel<A>

The new channel

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs
openSocketChannelback to summary
public abstract AFSocketChannel<A> openSocketChannel(SocketAddress sa) throws IOException

Opens a socket channel connected to the given SocketAddress.

Parameters
sa:SocketAddress

The socket address to connect to.

Returns:AFSocketChannel<A>

The new channel

Exceptions
IOException:
on error.
openSocketChannelback to summary
public AFSocketChannel<A> openSocketChannel(ProtocolFamily family) throws IOException

Overrides java.nio.channels.spi.SelectorProvider.openSocketChannel.

Doc from java.nio.channels.spi.SelectorProvider.openSocketChannel.

Opens a socket channel.

Parameters
family:ProtocolFamily

The protocol family

Returns:AFSocketChannel<A>

The new channel

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs
openSocketChannelPairback to summary
public AFSocketPair<? extends AFSocketChannel<A>> openSocketChannelPair() throws IOException

Opens a socket pair of interconnected channels.

Returns:AFSocketPair<? extends AFSocketChannel<A>>

The new channel pair.

Annotations
@SuppressWarnings:resource
Exceptions
IOException:
on error.
protocolFamilyback to summary
protected abstract ProtocolFamily protocolFamily()

Returns the protocol family supported by this implementation.

Returns:ProtocolFamily

The protocol family.

providerback to summary
public static SelectorProvider provider()

Hides java.nio.channels.spi.SelectorProvider.provider.

Returns the singleton instance for an "fallback" provider that supports the methods taking ProtocolFamily, as long as a junixsocket-specific AFProtocolFamily is used.

Returns:SelectorProvider

The instance.