Top Description Fields Constructors Methods
org.newsclub.net.unix

pack-priv final Class AFGenericSocket

extends AFSocket<AFGenericSocketAddress>
implements AFGenericSocketExtensions
Class Inheritance
All Implemented Interfaces
org.newsclub.net.unix.AFGenericSocketExtensions, org.newsclub.net.unix.AFSocketExtensions
Imports
java.io.FileDescriptor, .IOException, java.net.Socket, .SocketException

Implementation of an unknown-type socket.
Author
Christian Kohlschütter

Field Summary

Modifier and TypeField and Description
private static AFGenericSocketImplExtensions
Inherited from org.newsclub.net.unix.AFSocket:
loadedLibraryPROP_LIBRARY_DISABLE_CAPABILITY_PREFIX

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public static AFGenericSocket

Returns:

A new, connected socket.
connectTo
(AFGenericSocketAddress
The address to connect to.
addr
)

Creates a new AFSocket and connects it to the given AFGenericSocketAddress.

public AFGenericSocketChannel
getChannel()

Overrides org.newsclub.net.unix.AFSocket.getChannel.

Returns the unique SocketChannel object associated with this socket, if any.

private static synchronized AFGenericSocketImplExtensions
public static boolean

Returns:

true iff supported.
isSupported
()

Hides org.newsclub.net.unix.AFSocket.isSupported.

Returns true iff AFGenericSockets (sockets of unknown/otherwise unsupported type) are supported by the current Java VM and the kernel.

protected AFGenericSocketChannel
newChannel()

Implements abstract org.newsclub.net.unix.AFSocket.newChannel.

Creates a new AFSocketChannel for this socket.

public static AFGenericSocket

Returns:

A new, unbound socket.
newInstance
()

Creates a new, unbound AFSocket.

pack-priv static AFGenericSocket
public static AFGenericSocket

Returns:

A new, unbound socket.
newStrictInstance
()

Creates a new, unbound, "strict" AFSocket.

Inherited from org.newsclub.net.unix.AFSocket:
addCloseablebindcheckConnectionClosedcloseconnectconnectconnect0connectHookconnectToconnectToensureAncillaryReceiveBufferSizeensureSupportedensureUnsafeSupportedforceConnectAddressgetAFImplgetAFImplgetAncillaryReceiveBufferSizegetFileDescriptorgetImplExtensionsgetInputStreamgetLoadedLibrarygetLocalSocketAddressgetOutputStreamgetRemoteSocketAddressgetVersioninternalDummyBindinternalDummyConnectisBoundisClosedisConnectedisRunningOnAndroidnewInstancenewInstanceremoveCloseablesetAncillaryReceiveBufferSizesetShutdownOnClosesocketAddressClasssupportssupportstoStringtoStringSuffix

Field Detail

staticExtensionsback to summary
private static AFGenericSocketImplExtensions staticExtensions

Constructor Detail

AFGenericSocketback to summary
pack-priv AFGenericSocket(FileDescriptor fdObj, AFSocketFactory<AFGenericSocketAddress> factory) throws SocketException

Method Detail

connectToback to summary
public static AFGenericSocket connectTo(AFGenericSocketAddress addr) throws IOException

Creates a new AFSocket and connects it to the given AFGenericSocketAddress.

Parameters
addr:AFGenericSocketAddress

The address to connect to.

Returns:AFGenericSocket

A new, connected socket.

Exceptions
IOException:
if the operation fails.
getChannelback to summary
public AFGenericSocketChannel getChannel()

Overrides org.newsclub.net.unix.AFSocket.getChannel.

Doc from java.net.Socket.getChannel.

Returns the unique SocketChannel object associated with this socket, if any.

A socket will have a channel if, and only if, the channel itself was created via the SocketChannel.open or ServerSocketChannel.accept methods.

Returns:AFGenericSocketChannel

the socket channel associated with this socket, or null if this socket was not created for a channel

Annotations
@Override
getStaticImplExtensionsback to summary
private static synchronized AFGenericSocketImplExtensions getStaticImplExtensions() throws IOException
Annotations
@SuppressWarnings:unused
isSupportedback to summary
public static boolean isSupported()

Hides org.newsclub.net.unix.AFSocket.isSupported.

Returns true iff AFGenericSockets (sockets of unknown/otherwise unsupported type) are supported by the current Java VM and the kernel. To support AFGenericSockets, a custom JNI library must be loaded that is supplied with junixsocket. This call is equivalent to checking AFSocket#isSupported().

Returns:boolean

true iff supported.

newChannelback to summary
protected AFGenericSocketChannel newChannel()

Implements abstract org.newsclub.net.unix.AFSocket.newChannel.

Doc from org.newsclub.net.unix.AFSocket.newChannel.

Creates a new AFSocketChannel for this socket.

Returns:AFGenericSocketChannel

The new instance.

Annotations
@Override
newInstanceback to summary
public static AFGenericSocket newInstance() throws IOException

Creates a new, unbound AFSocket. This "default" implementation is a bit "lenient" with respect to the specification. In particular, we ignore calls to Socket#getTcpNoDelay() and Socket#setTcpNoDelay(boolean).

Returns:AFGenericSocket

A new, unbound socket.

Exceptions
IOException:
if the operation fails.
newInstanceback to summary
pack-priv static AFGenericSocket newInstance(AFGenericSocketFactory factory) throws SocketException
newStrictInstanceback to summary
public static AFGenericSocket newStrictInstance() throws IOException

Creates a new, unbound, "strict" AFSocket. This call uses an implementation that tries to be closer to the specification than newInstance(), at least for some cases.

Returns:AFGenericSocket

A new, unbound socket.

Exceptions
IOException:
if the operation fails.