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

public final Class AFSYSTEMSocketAddress

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

An AFSocketAddress for AF_SYSTEM sockets.
Author
Christian Kohlschütter

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
AFSYSTEMSocketAddress.SysAddr

The AF_SYSTEM system address.

Field Summary

Modifier and TypeField and Description
private static AFAddressFamily<AFSYSTEMSocketAddress>
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
AFSYSTEMSocketAddress(int port, final byte[] socketAddress, ObjectPool.Lease<ByteBuffer> nativeAddress)

Method Summary

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

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 int

Returns:

The id part.
getId
()

Returns the "id" part of the address.

public @NonNull AFSYSTEMSocketAddress.SysAddr

Returns:

The SysAddr part.
getSysAddr
()

Returns the "SysAddr" part of the address.

public int

Returns:

The unit part.
getUnit
()

Returns the "unit" part of the address.

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 AFSYSTEMSocketAddress.

public static boolean

Returns:

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

Checks if a SocketAddress can be unwrapped to an AFSYSTEMSocketAddress.

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

public static AFSYSTEMSocketAddress

Returns:

The address.
of
(URI
The URI.
uri
)

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

Returns an AFSYSTEMSocketAddress for the given URI, if possible.

public static AFSYSTEMSocketAddress

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 AFSYSTEMSocketAddress for the given URI, if possible.

public static AFSYSTEMSocketAddress

Returns:

A corresponding AFSYSTEMSocketAddress instance.
ofSysAddrIdUnit
(int
The emulated "port" number (not part of AF_SYSTEM).
javaPort
,
AFSYSTEMSocketAddress.SysAddr
16-bit system address (e.g., AF_SYS_KERNCONTROL)
sysAddr
,
int
Controller unique identifier
id
,
int
Developer private unit number, 0 means "unspecified".
unit
)

Returns an AFSYSTEMSocketAddress that refers to a given AF_SYSTEM socket address (i.e., referring to a particular socket instance instead of a service address).

public static AFSYSTEMSocketAddress

Returns:

A corresponding AFSYSTEMSocketAddress instance.
ofSysAddrIdUnit
(AFSYSTEMSocketAddress.SysAddr
16-bit system address (e.g., AF_SYS_KERNCONTROL)
sysAddr
,
int
Controller unique identifier
id
,
int
Developer private unit number
unit
)

Returns an AFSYSTEMSocketAddress that refers to a given AF_SYSTEM socket address (i.e., referring to a particular socket instance instead of a service address).

private static byte[]
toBytes(AFSYSTEMSocketAddress.SysAddr sysAddr, int id, int unit)

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 AFSYSTEMSocketAddress

Returns:

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

Returns an AFSYSTEMSocketAddress given a special InetAddress that encodes the byte sequence of an AF_SYSTEM socket address, like those returned by wrapAddress().

public static AFSYSTEMSocketAddress

Returns:

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

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

public static AFSYSTEMSocketAddress

Returns:

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

Returns an AFSYSTEMSocketAddress given a generic SocketAddress.

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

Field Detail

afSystemback to summary
private static AFAddressFamily<AFSYSTEMSocketAddress> afSystem
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

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

Method Detail

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

Returns the corresponding AFAddressFamily.

Returns:AFAddressFamily<AFSYSTEMSocketAddress>

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.
getIdback to summary
public int getId()

Returns the "id" part of the address.

Returns:int

The id part.

getSysAddrback to summary
public @NonNull AFSYSTEMSocketAddress.SysAddr getSysAddr()

Returns the "SysAddr" part of the address.

Returns:@NonNull AFSYSTEMSocketAddress.SysAddr

The SysAddr part.

getUnitback to summary
public int getUnit()

Returns the "unit" part of the address.

Returns:int

The unit part.

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 AFSYSTEMSocketAddress.

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 AFSYSTEMSocketAddress.

Parameters
addr:SocketAddress

The instance to check.

Returns:boolean

true if so.

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

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

Returns an AFSYSTEMSocketAddress for the given URI, if possible.

Parameters
uri:URI

The URI.

Returns:AFSYSTEMSocketAddress

The address.

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

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

Returns an AFSYSTEMSocketAddress 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:AFSYSTEMSocketAddress

The address.

Annotations
@SuppressWarnings:PMD.CognitiveComplexity, PMD.CyclomaticComplexity, PMD.ExcessiveMethodLength, PMD.NcssCount, PMD.NPathComplexity, PMD.ShortMethodName
Exceptions
SocketException:
if the operation fails.
ofSysAddrIdUnitback to summary
public static AFSYSTEMSocketAddress ofSysAddrIdUnit(int javaPort, AFSYSTEMSocketAddress.SysAddr sysAddr, int id, int unit) throws SocketException

Returns an AFSYSTEMSocketAddress that refers to a given AF_SYSTEM socket address (i.e., referring to a particular socket instance instead of a service address). A Java-only "IP port number" is stored along the instance for compatibility reasons.

Parameters
javaPort:int

The emulated "port" number (not part of AF_SYSTEM).

sysAddr:AFSYSTEMSocketAddress.SysAddr

16-bit system address (e.g., AF_SYS_KERNCONTROL)

id:int

Controller unique identifier

unit:int

Developer private unit number, 0 means "unspecified".

Returns:AFSYSTEMSocketAddress

A corresponding AFSYSTEMSocketAddress instance.

Exceptions
SocketException:
if the operation fails.
ofSysAddrIdUnitback to summary
public static AFSYSTEMSocketAddress ofSysAddrIdUnit(AFSYSTEMSocketAddress.SysAddr sysAddr, int id, int unit) throws SocketException

Returns an AFSYSTEMSocketAddress that refers to a given AF_SYSTEM socket address (i.e., referring to a particular socket instance instead of a service address).

Parameters
sysAddr:AFSYSTEMSocketAddress.SysAddr

16-bit system address (e.g., AF_SYS_KERNCONTROL)

id:int

Controller unique identifier

unit:int

Developer private unit number

Returns:AFSYSTEMSocketAddress

A corresponding AFSYSTEMSocketAddress instance.

Exceptions
SocketException:
if the operation fails.
toBytesback to summary
private static byte[] toBytes(AFSYSTEMSocketAddress.SysAddr sysAddr, int id, int unit)
Annotations
@SuppressWarnings:cast
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 AFSYSTEMSocketAddress unwrap(InetAddress address, int port) throws SocketException

Returns an AFSYSTEMSocketAddress given a special InetAddress that encodes the byte sequence of an AF_SYSTEM socket address, like those returned by wrapAddress().

Parameters
address:InetAddress

The "special" InetAddress.

port:int

The port (use 0 for "none").

Returns:AFSYSTEMSocketAddress

The AFSYSTEMSocketAddress instance.

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

Returns an AFSYSTEMSocketAddress given a special InetAddress hostname that encodes the byte sequence of an AF_SYSTEM 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:AFSYSTEMSocketAddress

The AFSYSTEMSocketAddress instance.

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

Returns an AFSYSTEMSocketAddress given a generic SocketAddress.

Parameters
address:SocketAddress

The address to unwrap.

Returns:AFSYSTEMSocketAddress

The AFSYSTEMSocketAddress instance.

Exceptions
SocketException:
if the operation fails, for example when an unsupported address is specified.
org.newsclub.net.unix back to summary

public final Class AFSYSTEMSocketAddress.SysAddr

extends NamedInteger
Class Inheritance
Annotations
@NonNullByDefault

The AF_SYSTEM system address.
Author
Christian Kohlschütter

Field Summary

Modifier and TypeField and Description
public static final AFSYSTEMSocketAddress.SysAddr
AF_SYS_CONTROL

The sysaddr AF_SYS_CONTROL, also known as AF_SYS_KERN_CONTROL.

private static final long
private static final @NonNull AFSYSTEMSocketAddress.SysAddr[]

Constructor Summary

AccessConstructor and Description
private
SysAddr(int id)

private
SysAddr(String name, int id)

Method Summary

Modifier and TypeMethod and Description
public static AFSYSTEMSocketAddress.SysAddr

Returns:

The SysAddr object.
ofValue
(int
The value.
v
)

Returns a SysAddr for the given custom value.

Inherited from org.newsclub.net.unix.NamedInteger:
equalshashCodeinitnameofValuetoStringvalue

Field Detail

AF_SYS_CONTROLback to summary
public static final AFSYSTEMSocketAddress.SysAddr AF_SYS_CONTROL

The sysaddr AF_SYS_CONTROL, also known as AF_SYS_KERN_CONTROL.

serialVersionUIDback to summary
private static final long serialVersionUID

Hides org.newsclub.net.unix.NamedInteger.serialVersionUID.

VALUESback to summary
private static final @NonNull AFSYSTEMSocketAddress.SysAddr[] VALUES

Constructor Detail

SysAddrback to summary
private SysAddr(int id)
SysAddrback to summary
private SysAddr(String name, int id)

Method Detail

ofValueback to summary
public static AFSYSTEMSocketAddress.SysAddr ofValue(int v)

Returns a SysAddr for the given custom value.

Parameters
v:int

The value.

Returns:AFSYSTEMSocketAddress.SysAddr

The SysAddr object.