AFSocketAddress that is supported by this type.
Socket.
| Modifier and Type | Class and Description |
|---|---|
| public static interface | AFSocket.
The concrete A extends AFSocketAddress>AFSocketAddress that is supported by this type.The reference to the constructor of an |
| Modifier and Type | Field and Description |
|---|---|
| private final AFSocketAddressFromHostname | |
| private static Integer | |
| private final AFSocketChannel | |
| private final Closeables | |
| private @Nullable SocketAddressFilter | |
| private final AtomicBoolean | |
| private final AFSocketImpl | impl
Hides java. |
| pack-priv static String | |
| pack-priv static final String | |
| private static final byte[] |
| Access | Constructor and Description |
|---|---|
| protected | AFSocket(final AFSocketImpl<A>
The corresponding impl, AFSocketAddressFromHostname<A> SocketImpl class.The conversion helper to get a socket address from an encoded hostname. afh)Creates a new |
| Modifier and Type | Method and Description |
|---|---|
| public final void | addCloseable(Closeable
The closeable. closeable)Registers a |
| public final void | bind(SocketAddress
the bindpoint)SocketAddress to bind toOverrides java. Not supported, since it's not necessary for client sockets. |
| private static synchronized int | |
| public boolean | Returns: true if the connection is known to be closed, false if the connection
is open/not closed or the condition is unknown.Probes the status of the socket connection. |
| public final synchronized void | close()
Overrides java. Implements java. Closes this stream and releases any system resources associated with it. |
| public final void | connect(SocketAddress
the endpoint)SocketAddressOverrides java. Connects this socket to the server. |
| public final void | connect(SocketAddress
the endpoint, int SocketAddressthe timeout value to be used in milliseconds. timeout)Overrides java. Connects this socket to the server with a specified timeout value. |
| pack-priv final boolean | |
| public final AFSocket | Returns: This instance.The function that gets called for each connect call. hook)Sets the hook for any subsequent call to |
| protected static final < The corresponding address type. A extends AFSocketAddress> @NonNull AFSocket | Returns: A new, connected socket.The implementation's constr,AFSocket constructorThe address to connect to. addr)Creates a new |
| public static final < The corresponding address type. A extends AFSocketAddress> AFSocket | Returns: A new, connected socket.The address to connect to. addr)Creates a new |
| public final void | ensureAncillaryReceiveBufferSize(int
The minimum size (in bytes). minSize)Implements org. Ensures a minimum ancillary receive buffer size. |
| public static void | |
| public static final void | ensureUnsafeSupported()
Checks if the current environment (system platform, native library, etc.) supports "unsafe"
operations (as controlled via the |
| public final AFSocket | Returns: This instance.The forced endpoint address. endpoint)Forces the address to be used for any subsequent call to |
| pack-priv final AFSocketImpl | |
| pack-priv final AFSocketImpl | |
| public final int | getAncillaryReceiveBufferSize()
Implements org. Returns the size of the receive buffer for ancillary messages (in bytes). |
| public AFSocketChannel | getChannel()
Overrides java. Returns the unique |
| public final FileDescriptor | getFileDescriptor()
Implements org. Returns the corresponding |
| protected final AFSocketImplExtensions | Returns: The helper instance.Returns the internal helper instance for address-specific extensions. |
| public final AFInputStream | |
| public static final String | Returns: The identifier of the loaded junixsocket-native library, ornull.Returns an identifier of the loaded native library, or |
| public final A | getLocalSocketAddress()
Overrides java. Implements org. Returns the socket's local socket address, or |
| public final AFOutputStream | getOutputStream()
Overrides java. Returns an output stream for this socket. |
| public final synchronized A | getRemoteSocketAddress()
Overrides java. Implements org. Returns the socket's remote socket address, or |
| public static final String | Returns: String The version identifier, ornull if it could not be determined.Returns the version of the junixsocket library, as a string, for debugging purposes. |
| private static int | |
| pack-priv final void | |
| pack-priv final void | |
| public final boolean | |
| private static boolean | |
| public final boolean | |
| public final boolean | |
| public static boolean | Returns: true if running on Android.Checks if we're running on Android (as far as junixsocket is concerned). |
| public static boolean | Returns: true iff supported.Returns |
| protected abstract AFSocketChannel | |
| pack-priv static <A extends AFSocketAddress> AFSocket | newInstance(AFSocket.
|
| protected static final < The corresponding address type. A extends AFSocketAddress> AFSocket | Returns: A new, unbound socket.The implementation's constr,AFSocket constructorThe corresponding socket factory, or factory)null.Creates a new, unbound |
| private static <A extends AFSocketAddress> @NonNull AFSocket | |
| private AFSocketAddress | |
| public final void | |
| public final void | setAncillaryReceiveBufferSize(int
The size. size)Implements org. Sets the size of the receive buffer for ancillary messages (in bytes). |
| public void | setShutdownOnClose(boolean
true if enabled.Implements org. Configures whether the socket should be shutdown upon |
| protected final Class | Returns: The supportedAFSocketAddress.Returns the |
| public static final boolean | Returns: true if supported.The capability. capability)
Deprecated
Checks if the current environment (system platform, native library, etc.) supports a given junixsocket capability. |
| public static final boolean | Returns: true if supported.The capability. capability)Checks if the current environment (system platform, native library, etc.) supports a given junixsocket capability. |
| public final String | |
| pack-priv final String |
| afh | back to summary |
|---|---|
| private final AFSocketAddressFromHostname<A> afh | |
| capabilitiesValue | back to summary |
|---|---|
| private static Integer capabilitiesValue | |
| channel | back to summary |
|---|---|
private final AFSocketChannel<A> channel
| |
| closeables | back to summary |
|---|---|
| private final Closeables closeables | |
| connectFilter | back to summary |
|---|---|
| private @Nullable SocketAddressFilter connectFilter | |
| created | back to summary |
|---|---|
| private final AtomicBoolean created | |
| impl | back to summary |
|---|---|
| private final AFSocketImpl<A> impl Hides java. | |
| loadedLibrary | back to summary |
|---|---|
pack-priv static String loadedLibrary
| |
| PROP_LIBRARY_DISABLE_CAPABILITY_PREFIX | back to summary |
|---|---|
| pack-priv static final String PROP_LIBRARY_DISABLE_CAPABILITY_PREFIX | |
| ZERO_BYTES | back to summary |
|---|---|
| private static final byte[] ZERO_BYTES | |
| AFSocket | back to summary |
|---|---|
| protected AFSocket(final AFSocketImpl<A> impl, AFSocketAddressFromHostname<A> afh) throws SocketException Creates a new
| |
| addCloseable | back to summary |
|---|---|
| public final void addCloseable(Closeable closeable) Registers a
| |
| bind | back to summary |
|---|---|
| public final void bind(SocketAddress bindpoint) throws IOException Overrides java. Not supported, since it's not necessary for client sockets.
| |
| capabilities | back to summary |
|---|---|
| private static synchronized int capabilities() | |
| checkConnectionClosed | back to summary |
|---|---|
| public boolean checkConnectionClosed() throws IOException Probes the status of the socket connection.
This usually involves checking for
| |
| close | back to summary |
|---|---|
| public final synchronized void close() throws IOException Overrides java. Implements java. Doc from java. Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect. As noted in
| |
| connect | back to summary |
|---|---|
| public final void connect(SocketAddress endpoint) throws IOException Overrides java. Doc from java. Connects this socket to the server. If the connection cannot be established, then the socket is closed,
and an This method is interruptible in the following circumstances:
| |
| connect | back to summary |
|---|---|
| public final void connect(SocketAddress endpoint, int timeout) throws IOException Overrides java. Doc from java. Connects this socket to the server with a specified timeout value. A timeout of zero is interpreted as an infinite timeout. The connection will then block until established or an error occurs. If the connection cannot be established, or the timeout expires
before the connection is established, then the socket is closed, and an
This method is interruptible in the following circumstances:
| |
| connect0 | back to summary |
|---|---|
| pack-priv final boolean connect0(SocketAddress endpoint, int timeout) throws IOException | |
| connectHook | back to summary |
|---|---|
| public final AFSocket Sets the hook for any subsequent call to
| |
| connectTo | back to summary |
|---|---|
| protected static final <A extends AFSocketAddress> @NonNull AFSocket Creates a new
| |
| connectTo | back to summary |
|---|---|
| public static final <A extends AFSocketAddress> AFSocket Creates a new
| |
| ensureAncillaryReceiveBufferSize | back to summary |
|---|---|
| public final void ensureAncillaryReceiveBufferSize(int minSize) Implements org. Doc from org. Ensures a minimum ancillary receive buffer size.
| |
| ensureSupported | back to summary |
|---|---|
| public static void ensureSupported() throws UnsupportedOperationException Checks if
| |
| ensureUnsafeSupported | back to summary |
|---|---|
| public static final void ensureUnsafeSupported() throws IOException Checks if the current environment (system platform, native library, etc.) supports "unsafe"
operations (as controlled via the
| |
| forceConnectAddress | back to summary |
|---|---|
| public final AFSocket Forces the address to be used for any subsequent call to
| |
| getAFImpl | back to summary |
|---|---|
| pack-priv final AFSocketImpl | |
| getAFImpl | back to summary |
|---|---|
| pack-priv final AFSocketImpl | |
| getAncillaryReceiveBufferSize | back to summary |
|---|---|
| public final int getAncillaryReceiveBufferSize() Implements org. Doc from org. Returns the size of the receive buffer for ancillary messages (in bytes).
| |
| getChannel | back to summary |
|---|---|
| public AFSocketChannel Overrides java. Doc from java. Returns the unique A socket will have a channel if, and only if, the channel itself was
created via the
| |
| getFileDescriptor | back to summary |
|---|---|
| public final FileDescriptor getFileDescriptor() throws IOException Implements org. Doc from org. Returns the corresponding
| |
| getImplExtensions | back to summary |
|---|---|
| protected final AFSocketImplExtensions Returns the internal helper instance for address-specific extensions.
| |
| getInputStream | back to summary |
|---|---|
| public final AFInputStream getInputStream() throws IOException Overrides java. Doc from java. Returns an input stream for this socket. If this socket has an associated channel then the resulting input
stream delegates all of its operations to the channel. If the channel
is in non-blocking mode then the input stream's Reading from the input stream is interruptible in the following circumstances:
Under abnormal conditions the underlying connection may be broken by the remote host or the network software (for example a connection reset in the case of TCP connections). When a broken connection is detected by the network software the following applies to the returned input stream :-
Closing the returned
| |
| getLoadedLibrary | back to summary |
|---|---|
| public static final String getLoadedLibrary() Returns an identifier of the loaded native library, or
| |
| getLocalSocketAddress | back to summary |
|---|---|
| public final A getLocalSocketAddress() Overrides java. Implements org. Doc from org. Returns the socket's local socket address, or
| |
| getOutputStream | back to summary |
|---|---|
| public final AFOutputStream getOutputStream() throws IOException Overrides java. Doc from java. Returns an output stream for this socket. If this socket has an associated channel then the resulting output
stream delegates all of its operations to the channel. If the channel
is in non-blocking mode then the output stream's Writing to the output stream is interruptible in the following circumstances:
Closing the returned
| |
| getRemoteSocketAddress | back to summary |
|---|---|
| public final synchronized A getRemoteSocketAddress() Overrides java. Implements org. Doc from org. Returns the socket's remote socket address, or
| |
| getVersion | back to summary |
|---|---|
| public static final String getVersion() Returns the version of the junixsocket library, as a string, for debugging purposes. Note Do not rely on the format of the version identifier, use socket capabilities instead.
| |
| initCapabilities | back to summary |
|---|---|
| private static int initCapabilities() | |
| internalDummyBind | back to summary |
|---|---|
| pack-priv final void internalDummyBind() throws IOException | |
| internalDummyConnect | back to summary |
|---|---|
| pack-priv final void internalDummyConnect() throws IOException | |
| isBound | back to summary |
|---|---|
| public final boolean isBound() Overrides java. Doc from java. Returns the binding state of the socket. Note Closing a socket doesn't clear its binding state, which means
this method will return
| |
| isCapDisabled | back to summary |
|---|---|
| private static boolean isCapDisabled(AFSocketCapability cap) | |
| isClosed | back to summary |
|---|---|
| public final boolean isClosed() Overrides java. Doc from java. Returns the closed state of the socket.
| |
| isConnected | back to summary |
|---|---|
| public final boolean isConnected() Overrides java. Doc from java. Returns the connection state of the socket. Note Closing a socket doesn't clear its connection state, which means
this method will return
| |
| isRunningOnAndroid | back to summary |
|---|---|
| public static boolean isRunningOnAndroid() Checks if we're running on Android (as far as junixsocket is concerned).
| |
| isSupported | back to summary |
|---|---|
| public static boolean isSupported() Returns
| |
| newChannel | back to summary |
|---|---|
| protected abstract AFSocketChannel Creates a new
| |
| newInstance | back to summary |
|---|---|
| pack-priv static <A extends AFSocketAddress> AFSocket | |
| newInstance | back to summary |
|---|---|
| protected static final <A extends AFSocketAddress> AFSocket Creates a new, unbound
| |
| newInstance0 | back to summary |
|---|---|
| private static <A extends AFSocketAddress> @NonNull AFSocket | |
| preprocessSocketAddress | back to summary |
|---|---|
| private AFSocketAddress preprocessSocketAddress(SocketAddress endpoint) throws SocketException | |
| removeCloseable | back to summary |
|---|---|
| public final void removeCloseable(Closeable closeable) Unregisters a previously registered
| |
| setAncillaryReceiveBufferSize | back to summary |
|---|---|
| public final void setAncillaryReceiveBufferSize(int size) Implements org. Doc from org. Sets the size of the receive buffer for ancillary messages (in bytes). To disable handling ancillary messages, set it to 0 (default).
| |
| setShutdownOnClose | back to summary |
|---|---|
| public void setShutdownOnClose(boolean enabled) Implements org. Doc from org. Configures whether the socket should be shutdown upon
| |
| socketAddressClass | back to summary |
|---|---|
| protected final Class Returns the
| |
| supports | back to summary |
|---|---|
| public static final boolean supports(AFUNIXSocketCapability capability)
Deprecated
Checks if the current environment (system platform, native library, etc.) supports a given
junixsocket capability.
Deprecated. Please use Note The result may or may not be cached from a previous call or from a check upon initialization.
| |
| supports | back to summary |
|---|---|
| public static final boolean supports(AFSocketCapability capability) Checks if the current environment (system platform, native library, etc.) supports a given junixsocket capability. Note The result may or may not be cached from a previous call or from a check upon initialization.
| |
| toString | back to summary |
|---|---|
| public final String toString() Overrides java. Doc from java. Converts this socket to a | |
| toStringSuffix | back to summary |
|---|---|
| pack-priv final String toStringSuffix() | |
AFSocketAddress that is supported by this type.
AFSocket subclass.
| Modifier and Type | Method and Description |
|---|---|
| public @NonNull AFSocket | Returns: The instance.The file descriptor. fdObj, AFSocketFactory<A> The socket factory instance. factory)Constructs a new |
| newInstance | back to summary |
|---|---|
| public @NonNull AFSocket Constructs a new
| |