Class AFAddressFamily<A extends AFSocketAddress>

java.lang.Object
org.newsclub.net.unix.AFAddressFamily<A>
Type Parameters:
A - The corresponding AFSocketAddress subclass.

public final class AFAddressFamily<A extends AFSocketAddress> extends Object
Describes an address family supported by junixsocket.
Author:
Christian Kohlschütter
  • 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 via registerAddressFamily(String, Class, AFSocketAddressConfig).
      config - The address family-specific configuration object.
      Returns:
      The corresponding AFAddressFamily instance.
    • newSocket

      public AFSocket<?> newSocket() throws IOException
      Creates a new, unconnected, unbound socket compatible with this socket address.
      Returns:
      The socket instance.
      Throws:
      IOException - on error.
    • newServerSocket

      public AFServerSocket<?> newServerSocket() throws IOException
      Creates a new, unconnected, unbound server socket compatible with this socket address.
      Returns:
      The server socket instance.
      Throws:
      IOException - on error.
    • newSocketChannel

      public AFSocketChannel<?> newSocketChannel() throws IOException
      Creates a new, unconnected, unbound SocketChannel compatible with this socket address.
      Returns:
      The socket instance.
      Throws:
      IOException - on error.
    • newServerSocketChannel

      public AFServerSocketChannel<?> newServerSocketChannel() throws IOException
      Creates a new, unconnected, unbound ServerSocketChannel compatible with this socket address.
      Returns:
      The socket instance.
      Throws:
      IOException - on error.
    • uriSchemes

      public static Set<String> uriSchemes()
      Returns the set of supported URI schemes that can be parsed to some AFSocketAddress. The set is dependent on which AFSocketAddress implementations are registered with junixsocket.
      Returns:
      The set of supported URI schemes.
    • getSelectorProvider

      public SelectorProvider getSelectorProvider()
      Returns the SelectorProvider associated with this address family, or null if no such instance is registered.
      Returns:
      The SelectorProvider.
      Throws:
      IllegalStateException - on error.
    • nullBindAddress

      public SocketAddress nullBindAddress() throws IOException
      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.