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

public final Class AFGenericSocketAddress

extends AFSocketAddress
Class Inheritance
Imports
java.io.File, .FileNotFoundException, .IOException, java.net.InetAddress, .SocketAddress, .SocketException, .URI, java.nio.ByteBuffer, java.util.Arrays, .Collections, .Objects, .Set, org.newsclub.net.unix.pool.ObjectPool.Lease

An AFSocketAddress for unknown socket types.
Author
Christian Kohlschütter

Field Summary

Modifier and TypeField and Description
private static AFAddressFamily<AFGenericSocketAddress>
private static final String
private static final long
Inherited from org.newsclub.net.unix.AFSocketAddress:
INTERNAL_DUMMY_BINDINTERNAL_DUMMY_CONNECTINTERNAL_DUMMY_DONT_CONNECTSOCKETADDRESS_BUFFER_TL

Constructor Summary

AccessConstructor and Description
private
AFGenericSocketAddress(int port, final byte[] socketAddress, ObjectPool.Lease<ByteBuffer> nativeAddress)

Method Summary

Modifier and TypeMethod and Description
public static synchronized AFAddressFamily<AFGenericSocketAddress>

Returns:

The address family instance.
addressFamily
()

Returns the corresponding AFAddressFamily.

public File
getFile()

Implements abstract org.newsclub.net.unix.AFSocketAddress.getFile.

Returns the File corresponding with this address, if possible.

public boolean
hasFilename()

Implements abstract org.newsclub.net.unix.AFSocketAddress.hasFilename.

Checks if the address can be resolved to a File.

public static boolean

Returns:

true if so.
isSupportedAddress
(InetAddress
The instance to check.
addr
)

Checks if an InetAddress can be unwrapped to an AFGenericSocketAddress.

public static boolean

Returns:

true if so.
isSupportedAddress
(SocketAddress
The instance to check.
addr
)

Checks if a SocketAddress can be unwrapped to an AFGenericSocketAddress.

private static AFGenericSocketAddress
newAFSocketAddress(int port, final byte[] socketAddress, ObjectPool.Lease<ByteBuffer> nativeAddress)

public static AFGenericSocketAddress

Returns:

The address.
of
(URI
The URI.
uri
)

Hides org.newsclub.net.unix.AFSocketAddress.of.

Returns an AFGenericSocketAddress for the given URI, if possible.

public static AFGenericSocketAddress

Returns:

The address.
of
(URI
The URI.
uri
,
int
The port to forcibly use, or -1 for "don't override".
overridePort
)

Hides org.newsclub.net.unix.AFSocketAddress.of.

Returns an AFGenericSocketAddress for the given URI, if possible.

public byte[]

Returns:

A new byte array containing the system-specific representation of that address.
toBytes
()

Returns the native representation of this generic address, which is most likely not portable.

public String
toString()

Overrides java.net.InetSocketAddress.toString.

Constructs a string representation of this InetSocketAddress.

public URI
toURI(String
The target scheme.
scheme
,
URI
An optional template to reuse certain parameters (e.g., the "path" component for an http request), or null.
template
)

Overrides org.newsclub.net.unix.AFSocketAddress.toURI.

Tries to create a URI based on this AFSocketAddress.

public static AFGenericSocketAddress

Returns:

The AFGenericSocketAddress instance.
unwrap
(InetAddress
The "special" InetAddress.
address
,
int
The port (use 0 for "none").
port
)

Returns an AFGenericSocketAddress given a special InetAddress that encodes the byte sequence of an unknown-type socket address, like those returned by wrapAddress().

public static AFGenericSocketAddress

Returns:

The AFGenericSocketAddress instance.
unwrap
(String
The "special" hostname, as provided by InetAddress#getHostName().
hostname
,
int
The port (use 0 for "none").
port
)

Returns an AFGenericSocketAddress given a special InetAddress hostname that encodes the byte sequence of an unknown-type socket address, like those returned by wrapAddress().

public static AFGenericSocketAddress

Returns:

The AFGenericSocketAddress instance.
unwrap
(SocketAddress
The address to unwrap.
address
)

Returns an AFGenericSocketAddress given a generic SocketAddress.

Inherited from org.newsclub.net.unix.AFSocketAddress:
canMapcanMapcoversgetAddressFamilygetBytesgetInetAddressgetInetAddressgetInetAddressgetNativeAddressDirectBuffergetNativeAddressDirectBuffergetSocketAddressisSupportedAddressisUseDeserializationForInitmapOrFailmapOrFailnewBoundServerSocketnewConnectedSocketnewDeserializedAFSocketAddressnewForceBoundServerSocketnewSockAddrDirectBuffernewSockAddrKeyBufferofInternalparseUnsignedIntpreprocessSocketAddressresolveAddresstoSocatAddressStringtoUnsignedStringtoUnsignedStringunwrapunwrapunwrapAddressDirectBufferInternalwrapAddresswriteNativeAddressTo

Field Detail

familyback to summary
private static AFAddressFamily<AFGenericSocketAddress> family
SELECTOR_PROVIDER_CLASSback to summary
private static final String SELECTOR_PROVIDER_CLASS
serialVersionUIDback to summary
private static final long serialVersionUID

Hides org.newsclub.net.unix.AFSocketAddress.serialVersionUID.

Constructor Detail

AFGenericSocketAddressback to summary
private AFGenericSocketAddress(int port, final byte[] socketAddress, ObjectPool.Lease<ByteBuffer> nativeAddress) throws SocketException

Method Detail

addressFamilyback to summary
public static synchronized AFAddressFamily<AFGenericSocketAddress> addressFamily()

Returns the corresponding AFAddressFamily.

Returns:AFAddressFamily<AFGenericSocketAddress>

The address family instance.

Annotations
@SuppressWarnings:null
getFileback to summary
public File getFile() throws FileNotFoundException

Implements abstract org.newsclub.net.unix.AFSocketAddress.getFile.

Doc from org.newsclub.net.unix.AFSocketAddress.getFile.

Returns the File corresponding with this address, if possible. A FileNotFoundException is thrown if there is no filename associated with the address, which applies to addresses in the abstract namespace, for example.

Returns:File

The filename.

Annotations
@Override
Exceptions
FileNotFoundException:
if the address is not associated with a filename.
hasFilenameback to summary
public boolean hasFilename()

Implements abstract org.newsclub.net.unix.AFSocketAddress.hasFilename.

Doc from org.newsclub.net.unix.AFSocketAddress.hasFilename.

Checks if the address can be resolved to a File.

Returns:boolean

true if the address has a filename.

Annotations
@Override
isSupportedAddressback to summary
public static boolean isSupportedAddress(InetAddress addr)

Checks if an InetAddress can be unwrapped to an AFGenericSocketAddress.

Parameters
addr:InetAddress

The instance to check.

Returns:boolean

true if so.

See Also
wrapAddress(), unwrap(InetAddress, int)
isSupportedAddressback to summary
public static boolean isSupportedAddress(SocketAddress addr)

Checks if a SocketAddress can be unwrapped to an AFGenericSocketAddress.

Parameters
addr:SocketAddress

The instance to check.

Returns:boolean

true if so.

See Also
unwrap(InetAddress, int)
newAFSocketAddressback to summary
private static AFGenericSocketAddress newAFSocketAddress(int port, final byte[] socketAddress, ObjectPool.Lease<ByteBuffer> nativeAddress) throws SocketException
ofback to summary
public static AFGenericSocketAddress of(URI uri) throws SocketException

Hides org.newsclub.net.unix.AFSocketAddress.of.

Returns an AFGenericSocketAddress for the given URI, if possible.

Parameters
uri:URI

The URI.

Returns:AFGenericSocketAddress

The address.

Annotations
@SuppressWarnings:PMD.ShortMethodName
Exceptions
SocketException:
if the operation fails.
ofback to summary
public static AFGenericSocketAddress of(URI uri, int overridePort) throws SocketException

Hides org.newsclub.net.unix.AFSocketAddress.of.

Returns an AFGenericSocketAddress for the given URI, if possible.

Parameters
uri:URI

The URI.

overridePort:int

The port to forcibly use, or -1 for "don't override".

Returns:AFGenericSocketAddress

The address.

Annotations
@SuppressWarnings:PMD.CognitiveComplexity, PMD.CyclomaticComplexity, PMD.ExcessiveMethodLength, PMD.NcssCount, PMD.NPathComplexity, PMD.ShortMethodName
Exceptions
SocketException:
if the operation fails.
toBytesback to summary
public byte[] toBytes()

Returns the native representation of this generic address, which is most likely not portable.

The address contains the sa_family identifier as the first byte, and, on some platforms only, the address length, as the second byte.

Returns:byte[]

A new byte array containing the system-specific representation of that address.

toStringback to summary
public String toString()

Overrides java.net.InetSocketAddress.toString.

Doc from java.net.InetSocketAddress.toString.

Constructs a string representation of this InetSocketAddress. This string is constructed by calling InetAddress#toString() on the InetAddress and concatenating the port number (with a colon).

If the address is an IPv6 address, the IPv6 literal is enclosed in square brackets, for example: "localhost/[0:0:0:0:0:0:0:1]:80". If the address is unresolved, <unresolved> is displayed in place of the address literal, for example "foo/<unresolved>:80".

To retrieve a string representation of the hostname or the address, use getHostString(), rather than parsing the string returned by this toString() method.

Returns:String

a string representation of this object.

Annotations
@Override
toURIback to summary
public URI toURI(String scheme, URI template) throws IOException

Overrides org.newsclub.net.unix.AFSocketAddress.toURI.

Doc from org.newsclub.net.unix.AFSocketAddress.toURI.

Tries to create a URI based on this AFSocketAddress.

Parameters
scheme:String

The target scheme.

template:URI

An optional template to reuse certain parameters (e.g., the "path" component for an http request), or null.

Returns:URI

The URI.

Annotations
@Override
@SuppressWarnings:PMD.CognitiveComplexity, PMD.CompareObjectsWithEquals
Exceptions
IOException:
on error.
unwrapback to summary
public static AFGenericSocketAddress unwrap(InetAddress address, int port) throws SocketException

Returns an AFGenericSocketAddress given a special InetAddress that encodes the byte sequence of an unknown-type socket address, like those returned by wrapAddress().

Parameters
address:InetAddress

The "special" InetAddress.

port:int

The port (use 0 for "none").

Returns:AFGenericSocketAddress

The AFGenericSocketAddress instance.

Exceptions
SocketException:
if the operation fails, for example when an unsupported address is specified.
unwrapback to summary
public static AFGenericSocketAddress unwrap(String hostname, int port) throws SocketException

Returns an AFGenericSocketAddress given a special InetAddress hostname that encodes the byte sequence of an unknown-type socket address, like those returned by wrapAddress().

Parameters
hostname:String

The "special" hostname, as provided by InetAddress#getHostName().

port:int

The port (use 0 for "none").

Returns:AFGenericSocketAddress

The AFGenericSocketAddress instance.

Exceptions
SocketException:
if the operation fails, for example when an unsupported address is specified.
unwrapback to summary
public static AFGenericSocketAddress unwrap(SocketAddress address) throws SocketException

Returns an AFGenericSocketAddress given a generic SocketAddress.

Parameters
address:SocketAddress

The address to unwrap.

Returns:AFGenericSocketAddress

The AFGenericSocketAddress instance.

Exceptions
SocketException:
if the operation fails, for example when an unsupported address is specified.