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, portFields 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
ConstructorsModifierConstructorDescriptionprotectedAFSocketImpl(AFAddressFamily<@NonNull A> addressFamily, FileDescriptor fdObj) Creates a newAFSocketImplinstance. -
Method Summary
Modifier and TypeMethodDescriptionprotected final voidaccept(SocketImpl socket) protected final intprotected final voidbind(InetAddress host, int port) protected final voidclose()protected final voidprotected final voidconnect(InetAddress address, int port) protected final voidconnect(SocketAddress addr, int connectTimeout) protected final voidcreate(boolean stream) protected final FileDescriptorprotected final AFSocketImplExtensions<A> Returns the internal helper instance for address-specific extensions.protected final InetAddressprotected final AFInputStreamgetOption(int optID) protected <T> TgetOption(SocketOption<T> name) protected final ObjectgetOptionLenient(int optID) LikegetOption(int), but ignores exceptions for certain option IDs.protected final AFOutputStreamprotected final voidlisten(int backlog) protected final AFInputStreamCreates a newInputStreamfor this socket.protected final AFOutputStreamCreates a newOutputStreamfor this socket.protected final voidsendUrgentData(int data) voidprotected <T> voidsetOption(SocketOption<T> name, T value) protected final voidsetOptionLenient(int optID, Object value) LikesetOption(int, Object), but ignores exceptions for certain option IDs.protected final voidshutdown()Shuts down both input and output at once.protected final voidprotected final voidprotected Set<SocketOption<?>> protected final booleanfinal StringtoString()Methods inherited from class java.net.SocketImpl
getLocalPort, getPort, setPerformancePreferences
-
Constructor Details
-
AFSocketImpl
Creates a newAFSocketImplinstance.- Parameters:
addressFamily- The address family.fdObj- The socket'sFileDescriptor.
-
-
Method Details
-
newInputStream
Creates a newInputStreamfor this socket.- Returns:
- The new stream.
-
newOutputStream
Creates a newOutputStreamfor this socket.- Returns:
- The new stream.
-
accept
- Specified by:
acceptin classSocketImpl- Throws:
IOException
-
available
- Specified by:
availablein classSocketImpl- Throws:
IOException
-
bind
- Specified by:
bindin classSocketImpl- Throws:
IOException
-
close
- Specified by:
closein classSocketImpl- Throws:
IOException
-
connect
- Specified by:
connectin classSocketImpl- Throws:
IOException
-
connect
- Specified by:
connectin classSocketImpl- Throws:
IOException
-
connect
- Specified by:
connectin classSocketImpl- Throws:
IOException
-
create
- Specified by:
createin classSocketImpl- Throws:
IOException
-
getInputStream
- Specified by:
getInputStreamin classSocketImpl- Throws:
IOException
-
getOutputStream
- Specified by:
getOutputStreamin classSocketImpl- Throws:
IOException
-
listen
- Specified by:
listenin classSocketImpl- Throws:
IOException
-
supportsUrgentData
protected final boolean supportsUrgentData()- Overrides:
supportsUrgentDatain classSocketImpl
-
sendUrgentData
- Specified by:
sendUrgentDatain classSocketImpl- Throws:
IOException
-
toString
- Overrides:
toStringin 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:
shutdownInputin classSocketImpl- Throws:
IOException
-
shutdownOutput
- Overrides:
shutdownOutputin classSocketImpl- Throws:
IOException
-
getFileDescriptor
- Overrides:
getFileDescriptorin classSocketImpl
-
getInetAddress
- Overrides:
getInetAddressin classSocketImpl
-
setOption
- Overrides:
setOptionin classSocketImpl- Throws:
IOException
-
getOption
- Overrides:
getOptionin classSocketImpl- Throws:
IOException
-
supportedOptions
- Overrides:
supportedOptionsin 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.
-