Module org.newsclub.net.unix.vsock
Package org.newsclub.net.unix.vsock
Class AFVSOCKSelectorProvider
java.lang.Object
java.nio.channels.spi.SelectorProvider
org.newsclub.net.unix.AFSelectorProvider<AFVSOCKSocketAddress>
org.newsclub.net.unix.vsock.AFVSOCKSelectorProvider
Service-provider class for junixsocket selectors and selectable channels.
-
Method Summary
Modifier and TypeMethodDescriptionprotected AFAddressFamily
<@NonNull AFVSOCKSocketAddress> Returns the address family supported by this implementation.static AFVSOCKSelectorProvider
Returns the singleton instance.protected AFVSOCKSocket
Constructs a new socket.protected <P extends AFSomeSocket>
AFSocketPair<P> newSocketPair
(P s1, P s2) Constructs a new socket pair from two sockets.openDatagramChannel
(ProtocolFamily family) Opens aDatagramChannel
using the given socket type.Opens a socket pair of interconnected datagram channels.Opens a socket pair of interconnectedDatagramChannel
s, using the givenAFSocketType
.Opens a server-socket channel bound on the givenSocketAddress
.Opens a socket channel connected to the givenSocketAddress
.Opens a socket pair of interconnected channels.protected ProtocolFamily
Returns the protocol family supported by this implementation.static AFVSOCKSelectorProvider
provider()
Returns the singleton instance.Methods inherited from class org.newsclub.net.unix.AFSelectorProvider
domainId, openPipe, openSelector, openServerSocketChannel, openSocketChannel
Methods inherited from class java.nio.channels.spi.SelectorProvider
inheritedChannel
-
Method Details
-
getInstance
Returns the singleton instance.- Returns:
- The instance.
-
provider
Returns the singleton instance.- Returns:
- The instance.
-
newSocketPair
Constructs a new socket pair from two sockets.- Specified by:
newSocketPair
in classAFSelectorProvider<AFVSOCKSocketAddress>
- Type Parameters:
P
- The type of the pair.- Parameters:
s1
- Some socket, the first one.s2
- Some socket, the second one.- Returns:
- The pair.
-
openSocketChannelPair
Description copied from class:AFSelectorProvider
Opens a socket pair of interconnected channels.- Overrides:
openSocketChannelPair
in classAFSelectorProvider<AFVSOCKSocketAddress>
- Returns:
- The new channel pair.
- Throws:
IOException
- on error.
-
openDatagramChannelPair
Description copied from class:AFSelectorProvider
Opens a socket pair of interconnected datagram channels.- Overrides:
openDatagramChannelPair
in classAFSelectorProvider<AFVSOCKSocketAddress>
- Returns:
- The new channel pair.
- Throws:
IOException
- on error.
-
openDatagramChannelPair
public AFVSOCKSocketPair<AFVSOCKDatagramChannel> openDatagramChannelPair(AFSocketType type) throws IOException Description copied from class:AFSelectorProvider
Opens a socket pair of interconnectedDatagramChannel
s, using the givenAFSocketType
.- Overrides:
openDatagramChannelPair
in classAFSelectorProvider<AFVSOCKSocketAddress>
- Parameters:
type
- The socket type.- Returns:
- The new channel pair.
- Throws:
IOException
- on error.
-
newSocket
Description copied from class:AFSelectorProvider
Constructs a new socket.- Specified by:
newSocket
in classAFSelectorProvider<AFVSOCKSocketAddress>
- Returns:
- The socket instance.
- Throws:
IOException
- on error.
-
openDatagramChannel
- Specified by:
openDatagramChannel
in classAFSelectorProvider<AFVSOCKSocketAddress>
- Throws:
IOException
-
openDatagramChannel
Description copied from class:AFSelectorProvider
Opens aDatagramChannel
using the given socket type.- Specified by:
openDatagramChannel
in classAFSelectorProvider<AFVSOCKSocketAddress>
- Parameters:
type
- The socket type.- Returns:
- the new channel
- Throws:
IOException
- on error.
-
openDatagramChannel
- Overrides:
openDatagramChannel
in classAFSelectorProvider<AFVSOCKSocketAddress>
- Throws:
IOException
-
openServerSocketChannel
- Specified by:
openServerSocketChannel
in classAFSelectorProvider<AFVSOCKSocketAddress>
- Throws:
IOException
-
openServerSocketChannel
Description copied from class:AFSelectorProvider
Opens a server-socket channel bound on the givenSocketAddress
.- Specified by:
openServerSocketChannel
in classAFSelectorProvider<AFVSOCKSocketAddress>
- Parameters:
sa
- The socket address to bind on.- Returns:
- The new channel
- Throws:
IOException
- on error.
-
openSocketChannel
- Overrides:
openSocketChannel
in classAFSelectorProvider<AFVSOCKSocketAddress>
- Throws:
IOException
-
openSocketChannel
Description copied from class:AFSelectorProvider
Opens a socket channel connected to the givenSocketAddress
.- Specified by:
openSocketChannel
in classAFSelectorProvider<AFVSOCKSocketAddress>
- Parameters:
sa
- The socket address to connect to.- Returns:
- The new channel
- Throws:
IOException
- on error.
-
protocolFamily
Description copied from class:AFSelectorProvider
Returns the protocol family supported by this implementation.- Specified by:
protocolFamily
in classAFSelectorProvider<AFVSOCKSocketAddress>
- Returns:
- The protocol family.
-
addressFamily
Description copied from class:AFSelectorProvider
Returns the address family supported by this implementation.- Specified by:
addressFamily
in classAFSelectorProvider<AFVSOCKSocketAddress>
- Returns:
- The address family.
-