Module org.newsclub.net.unix
Package org.newsclub.net.unix
Class AFAddressFamily<A extends AFSocketAddress>
java.lang.Object
org.newsclub.net.unix.AFAddressFamily<A>
- Type Parameters:
A
- The correspondingAFSocketAddress
subclass.
Describes an address family supported by junixsocket.
- Author:
- Christian Kohlschütter
-
Method Summary
Modifier and TypeMethodDescriptionReturns theSelectorProvider
associated with this address family, ornull
if no such instance is registered.Creates a new, unconnected, unbound server socket compatible with this socket address.Creates a new, unconnected, unboundServerSocketChannel
compatible with this socket address.AFSocket
<?> Creates a new, unconnected, unbound socket compatible with this socket address.Creates a new, unconnected, unboundSocketChannel
compatible with this socket address.Returns an appropriate SocketAddress to be used when calling bind with a null argument.static <A extends AFSocketAddress>
AFAddressFamily<A> registerAddressFamily
(String juxString, Class<A> addressClass, AFSocketAddressConfig<A> config) Registers an address family.static <A extends AFSocketAddress>
AFAddressFamily<A> registerAddressFamilyImpl
(String juxString, AFAddressFamily<A> addressFamily, AFAddressFamilyConfig<A> config) Registers an implementation.Returns the set of supported URI schemes that can be parsed to someAFSocketAddress
.
-
Method Details
-
registerAddressFamily
public static <A extends AFSocketAddress> AFAddressFamily<A> registerAddressFamily(String juxString, Class<A> addressClass, AFSocketAddressConfig<A> config) Registers an address family.- Type Parameters:
A
- The supported address type.- Parameters:
juxString
- The sockaddr_* identifier as registered in native code.addressClass
- The supported address subclass.config
- The address-specific config object.- Returns:
- The corresponding
AFAddressFamily
instance.
-
registerAddressFamilyImpl
public static <A extends AFSocketAddress> AFAddressFamily<A> registerAddressFamilyImpl(String juxString, AFAddressFamily<A> addressFamily, AFAddressFamilyConfig<A> config) Registers an implementation.- Type Parameters:
A
- The supported address type.- Parameters:
juxString
- The sockaddr_* identifier as registered in native code.addressFamily
- The supported address family as registered viaregisterAddressFamily(String, Class, AFSocketAddressConfig)
.config
- The address family-specific configuration object.- Returns:
- The corresponding
AFAddressFamily
instance.
-
newSocket
Creates a new, unconnected, unbound socket compatible with this socket address.- Returns:
- The socket instance.
- Throws:
IOException
- on error.
-
newServerSocket
Creates a new, unconnected, unbound server socket compatible with this socket address.- Returns:
- The server socket instance.
- Throws:
IOException
- on error.
-
newSocketChannel
Creates a new, unconnected, unboundSocketChannel
compatible with this socket address.- Returns:
- The socket instance.
- Throws:
IOException
- on error.
-
newServerSocketChannel
Creates a new, unconnected, unboundServerSocketChannel
compatible with this socket address.- Returns:
- The socket instance.
- Throws:
IOException
- on error.
-
uriSchemes
Returns the set of supported URI schemes that can be parsed to someAFSocketAddress
. The set is dependent on whichAFSocketAddress
implementations are registered with junixsocket.- Returns:
- The set of supported URI schemes.
-
getSelectorProvider
Returns theSelectorProvider
associated with this address family, ornull
if no such instance is registered.- Returns:
- The
SelectorProvider
. - Throws:
IllegalStateException
- on error.
-
nullBindAddress
Returns an appropriate SocketAddress to be used when calling bind with a null argument.- Returns:
- The new socket address, or
null
. - Throws:
IOException
- on error.
-