Module org.newsclub.net.unix
Package org.newsclub.net.unix
Class AFSocketImpl<A extends AFSocketAddress>
java.lang.Object
java.net.SocketImpl
org.newsclub.net.unix.AFSocketImpl<A>
- Type Parameters:
A
- The supported address type.
- All Implemented Interfaces:
SocketOptions
junixsocket-based
SocketImpl
.- Author:
- Christian Kohlschütter
-
Field Summary
Fields inherited from class java.net.SocketImpl
address, fd, localport, port
Fields inherited from interface java.net.SocketOptions
IP_MULTICAST_IF, IP_MULTICAST_IF2, IP_MULTICAST_LOOP, IP_TOS, SO_BINDADDR, SO_BROADCAST, SO_KEEPALIVE, SO_LINGER, SO_OOBINLINE, SO_RCVBUF, SO_REUSEADDR, SO_REUSEPORT, SO_SNDBUF, SO_TIMEOUT, TCP_NODELAY
-
Constructor Summary
ModifierConstructorDescriptionprotected
AFSocketImpl
(AFAddressFamily<@NonNull A> addressFamily, FileDescriptor fdObj) Creates a newAFSocketImpl
instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected final void
accept
(SocketImpl socket) protected final int
protected final void
bind
(InetAddress host, int port) protected final void
close()
protected final void
protected final void
connect
(InetAddress address, int port) protected final void
connect
(SocketAddress addr, int connectTimeout) protected final void
create
(boolean stream) protected final FileDescriptor
protected final AFSocketImplExtensions
<A> Returns the internal helper instance for address-specific extensions.protected final InetAddress
protected final AFInputStream
getOption
(int optID) protected <T> T
getOption
(SocketOption<T> name) protected final Object
getOptionLenient
(int optID) LikegetOption(int)
, but ignores exceptions for certain option IDs.protected final AFOutputStream
protected final void
listen
(int backlog) protected final AFInputStream
Creates a newInputStream
for this socket.protected final AFOutputStream
Creates a newOutputStream
for this socket.protected final void
sendUrgentData
(int data) void
protected <T> void
setOption
(SocketOption<T> name, T value) protected final void
setOptionLenient
(int optID, Object value) LikesetOption(int, Object)
, but ignores exceptions for certain option IDs.protected final void
shutdown()
Shuts down both input and output at once.protected final void
protected final void
protected Set
<SocketOption<?>> protected final boolean
final String
toString()
Methods inherited from class java.net.SocketImpl
getLocalPort, getPort, setPerformancePreferences
-
Constructor Details
-
AFSocketImpl
Creates a newAFSocketImpl
instance.- Parameters:
addressFamily
- The address family.fdObj
- The socket'sFileDescriptor
.
-
-
Method Details
-
newInputStream
Creates a newInputStream
for this socket.- Returns:
- The new stream.
-
newOutputStream
Creates a newOutputStream
for this socket.- Returns:
- The new stream.
-
accept
- Specified by:
accept
in classSocketImpl
- Throws:
IOException
-
available
- Specified by:
available
in classSocketImpl
- Throws:
IOException
-
bind
- Specified by:
bind
in classSocketImpl
- Throws:
IOException
-
close
- Specified by:
close
in classSocketImpl
- Throws:
IOException
-
connect
- Specified by:
connect
in classSocketImpl
- Throws:
IOException
-
connect
- Specified by:
connect
in classSocketImpl
- Throws:
IOException
-
connect
- Specified by:
connect
in classSocketImpl
- Throws:
IOException
-
create
- Specified by:
create
in classSocketImpl
- Throws:
IOException
-
getInputStream
- Specified by:
getInputStream
in classSocketImpl
- Throws:
IOException
-
getOutputStream
- Specified by:
getOutputStream
in classSocketImpl
- Throws:
IOException
-
listen
- Specified by:
listen
in classSocketImpl
- Throws:
IOException
-
supportsUrgentData
protected final boolean supportsUrgentData()- Overrides:
supportsUrgentData
in classSocketImpl
-
sendUrgentData
- Specified by:
sendUrgentData
in classSocketImpl
- Throws:
IOException
-
toString
- Overrides:
toString
in classSocketImpl
-
getOption
- Throws:
SocketException
-
setOption
- Throws:
SocketException
-
getOptionLenient
LikegetOption(int)
, but ignores exceptions for certain option IDs.- Parameters:
optID
- The option ID.- Returns:
- The value.
- Throws:
SocketException
- on error.
-
setOptionLenient
LikesetOption(int, Object)
, but ignores exceptions for certain option IDs.- Parameters:
optID
- The option ID.value
- The value.- Throws:
SocketException
- on error.
-
shutdown
Shuts down both input and output at once. Equivalent to callingshutdownInput()
andshutdownOutput()
.- Throws:
IOException
- on error.
-
shutdownInput
- Overrides:
shutdownInput
in classSocketImpl
- Throws:
IOException
-
shutdownOutput
- Overrides:
shutdownOutput
in classSocketImpl
- Throws:
IOException
-
getFileDescriptor
- Overrides:
getFileDescriptor
in classSocketImpl
-
getInetAddress
- Overrides:
getInetAddress
in classSocketImpl
-
setOption
- Overrides:
setOption
in classSocketImpl
- Throws:
IOException
-
getOption
- Overrides:
getOption
in classSocketImpl
- Throws:
IOException
-
supportedOptions
- Overrides:
supportedOptions
in classSocketImpl
-
getImplExtensions
Returns the internal helper instance for address-specific extensions.- Returns:
- The helper instance.
- Throws:
UnsupportedOperationException
- if such extensions are not supported for this address type.
-