Class AFUNIXSocketFactory.FactoryArg
java.lang.Object
javax.net.SocketFactory
org.newsclub.net.unix.AFSocketFactory<AFUNIXSocketAddress>
org.newsclub.net.unix.AFUNIXSocketFactory
org.newsclub.net.unix.AFUNIXSocketFactory.FactoryArg
- All Implemented Interfaces:
AFSocketAddressFromHostname<AFUNIXSocketAddress>
- Enclosing class:
AFUNIXSocketFactory
A socket factory that handles a custom hostname ("localhost", by default, and configured by the
system property "org.newsclub.net.unix.socket.hostname"), forwarding all other
requests to the fallback
SocketFactory.
The socket path is configured through an argument passed by to the constructor.
This is particularly useful for JDBC drivers that take a "socketFactory" and a
"socketFactoryArg". The latter will be passed as a constructor argument.-
Nested Class Summary
Nested classes/interfaces inherited from class AFUNIXSocketFactory
AFUNIXSocketFactory.FactoryArg, AFUNIXSocketFactory.SystemProperty, AFUNIXSocketFactory.URISchemeModifier and TypeClassDescriptionstatic final classA socket factory that handles a custom hostname ("localhost", by default, and configured by the system property "org.newsclub.net.unix.socket.hostname"), forwarding all other requests to the fallbackSocketFactory.static final classA socket factory that handles a custom hostname ("junixsocket.localhost", by default, and configured by the system property "org.newsclub.net.unix.socket.hostname"), forwarding all other requests to the fallbackSocketFactory.static final classA socket factory that handles special host names formatted as file:// URIs.Nested classes/interfaces inherited from class AFSocketFactory
AFSocketFactory.FixedAddressSocketFactoryModifier and TypeClassDescriptionstatic final classA socket factory that always connects to a fixed socket address, no matter what. -
Constructor Summary
ConstructorsConstructorDescriptionFactoryArg(File file) Constructs a newAFUNIXSocketFactory.FactoryArgfactory using the given socket path.FactoryArg(String socketPath) Constructs a newAFUNIXSocketFactory.FactoryArgfactory using the given socket path. -
Method Summary
Modifier and TypeMethodDescriptionaddressFromHost(String host, int port) Translates a "host" string (and port) to anAFSocketAddress.final booleanisHostnameSupported(String host) Checks whether the given hostname is supported by this socket factory.Methods inherited from class AFUNIXSocketFactory
connectTo, createSocketModifier and TypeMethodDescriptionprotected AFUNIXSocketconnectTo(AFUNIXSocketAddress addr) Creates a newAFSocket, connected to the given address.Methods inherited from class AFSocketFactory
createSocket, createSocket, createSocket, createSocket, isInetAddressSupportedModifier and TypeMethodDescriptionfinal SocketcreateSocket(String host, int port) final SocketcreateSocket(String host, int port, InetAddress localHost, int localPort) final SocketcreateSocket(InetAddress address, int port) final SocketcreateSocket(InetAddress address, int port, InetAddress localAddress, int localPort) protected final booleanisInetAddressSupported(InetAddress address) Checks whether the givenInetAddressis supported by this socket factory.Methods inherited from class SocketFactory
getDefault
-
Constructor Details
-
FactoryArg
Constructs a newAFUNIXSocketFactory.FactoryArgfactory using the given socket path.- Parameters:
socketPath- The path to the socket.
-
FactoryArg
Constructs a newAFUNIXSocketFactory.FactoryArgfactory using the given socket path.- Parameters:
file- The path to the socket.
-
-
Method Details
-
addressFromHost
Description copied from interface:AFSocketAddressFromHostnameTranslates a "host" string (and port) to anAFSocketAddress.- Parameters:
host- The hostnameport- The port, or 0.- Returns:
- The
AFSocketAddress - Throws:
SocketException- If there was a problem converting the hostname
-
isHostnameSupported
Description copied from interface:AFSocketAddressFromHostnameChecks whether the given hostname is supported by this socket factory. If not, calls to createSocket will cause aSocketException.- Parameters:
host- The host to check.- Returns:
trueif supported.
-