Module org.newsclub.net.unix
Package org.newsclub.net.unix
Class AFSelectorProvider<A extends AFSocketAddress>
java.lang.Object
java.nio.channels.spi.SelectorProvider
org.newsclub.net.unix.AFSelectorProvider<A>
- Type Parameters:
A- The concreteAFSocketAddressthat is supported by this type.
- Direct Known Subclasses:
AFSYSTEMSelectorProvider,AFTIPCSelectorProvider,AFUNIXSelectorProvider,AFVSOCKSelectorProvider
Service-provider class for junixsocket selectors and selectable channels.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract AFAddressFamily<@NonNull A> Returns the address family supported by this implementation.protected final intdomainId()Returns the domain ID for the supported protocol, as specified byNativeUnixSocket.Constructs a new socket.protected abstract <Y extends AFSomeSocket>
AFSocketPair<Y> newSocketPair(Y s1, Y s2) Constructs a new socket pair from two sockets.abstract AFDatagramChannel<A> openDatagramChannel(ProtocolFamily family) abstract AFDatagramChannel<A> Opens aDatagramChannelusing the given socket type.AFSocketPair<? extends AFDatagramChannel<A>> Opens a socket pair of interconnected datagram channels.AFSocketPair<? extends AFDatagramChannel<A>> Opens a socket pair of interconnectedDatagramChannels, using the givenAFSocketType.final AFPipeopenPipe()final AbstractSelectorabstract AFServerSocketChannel<A> abstract AFServerSocketChannel<A> Opens a server-socket channel bound on the givenSocketAddress.openSocketChannel(ProtocolFamily family) abstract AFSocketChannel<A> Opens a socket channel connected to the givenSocketAddress.AFSocketPair<? extends AFSocketChannel<A>> Opens a socket pair of interconnected channels.protected abstract ProtocolFamilyReturns the protocol family supported by this implementation.static SelectorProviderprovider()Returns the singleton instance for an "fallback" provider that supports the methods takingProtocolFamily, as long as a junixsocket-specificAFProtocolFamilyis used.Methods inherited from class java.nio.channels.spi.SelectorProvider
inheritedChannel
-
Constructor Details
-
AFSelectorProvider
protected AFSelectorProvider()Constructs a newAFSelectorProvider.
-
-
Method Details
-
newSocketPair
Constructs a new socket pair from two sockets.- Type Parameters:
Y- The type of the pair.- Parameters:
s1- Some socket, the first one.s2- Some socket, the second one.- Returns:
- The pair.
-
newSocket
Constructs a new socket.- Returns:
- The socket instance.
- Throws:
IOException- on error.
-
protocolFamily
Returns the protocol family supported by this implementation.- Returns:
- The protocol family.
-
addressFamily
Returns the address family supported by this implementation.- Returns:
- The address family.
-
domainId
protected final int domainId()Returns the domain ID for the supported protocol, as specified byNativeUnixSocket.- Returns:
- The domain ID.
-
openSocketChannelPair
Opens a socket pair of interconnected channels.- Returns:
- The new channel pair.
- Throws:
IOException- on error.
-
openDatagramChannelPair
Opens a socket pair of interconnected datagram channels.- Returns:
- The new channel pair.
- Throws:
IOException- on error.
-
openDatagramChannelPair
public AFSocketPair<? extends AFDatagramChannel<A>> openDatagramChannelPair(AFSocketType type) throws IOException Opens a socket pair of interconnectedDatagramChannels, using the givenAFSocketType.- Parameters:
type- The socket type.- Returns:
- The new channel pair.
- Throws:
IOException- on error.
-
openDatagramChannel
- Specified by:
openDatagramChannelin classSelectorProvider- Throws:
IOException
-
openDatagramChannel
Opens aDatagramChannelusing the given socket type.- Parameters:
type- The socket type.- Returns:
- the new channel
- Throws:
IOException- on error.
-
openPipe
- Specified by:
openPipein classSelectorProvider- Throws:
IOException
-
openSelector
- Specified by:
openSelectorin classSelectorProvider- Throws:
IOException
-
openServerSocketChannel
- Specified by:
openServerSocketChannelin classSelectorProvider- Throws:
IOException
-
openServerSocketChannel
public abstract AFServerSocketChannel<A> openServerSocketChannel(SocketAddress sa) throws IOException Opens a server-socket channel bound on the givenSocketAddress.- Parameters:
sa- The socket address to bind on.- Returns:
- The new channel
- Throws:
IOException- on error.
-
openSocketChannel
- Specified by:
openSocketChannelin classSelectorProvider- Throws:
IOException
-
openSocketChannel
Opens a socket channel connected to the givenSocketAddress.- Parameters:
sa- The socket address to connect to.- Returns:
- The new channel
- Throws:
IOException- on error.
-
openSocketChannel
- Overrides:
openSocketChannelin classSelectorProvider- Throws:
IOException
-
openServerSocketChannel
- Overrides:
openServerSocketChannelin classSelectorProvider- Throws:
IOException
-
openDatagramChannel
- Specified by:
openDatagramChannelin classSelectorProvider- Throws:
IOException
-
provider
Returns the singleton instance for an "fallback" provider that supports the methods takingProtocolFamily, as long as a junixsocket-specificAFProtocolFamilyis used.- Returns:
- The instance.
-