java.lang.Object
java.net.SocketAddress
java.net.UnixDomainSocketAddress
- All Implemented Interfaces:
-
Serializable
public final class UnixDomainSocketAddress extends SocketAddress
A Unix domain socket address. A Unix domain socket address encapsulates a file-system path that Unix domain sockets bind or connect to.
An unnamedUnixDomainSocketAddress
has an empty path. The local address of a Unix domain socket that is automatically bound will be unnamed.
Path
objects used to create instances of this class must be obtained from the system-default file system.
- Since:
- 16
- See Also:
-
SocketChannel
,ServerSocketChannel
, Serialized Form
-
Method Summary
Modifier and Type Method Description boolean
equals(Object o)
Compares this address with another object.Path
getPath()
Return this address's path.int
hashCode()
Returns the hash code of thisUnixDomainSocketAddress
static UnixDomainSocketAddress
of(String pathname)
Create a UnixDomainSocketAddress from the given path string.static UnixDomainSocketAddress
of(Path path)
Create a UnixDomainSocketAddress for the given path.String
toString()
Returns a string representation of thisUnixDomainSocketAddress
.
-
Method Details
-
of
Create a UnixDomainSocketAddress from the given path string.- Parameters:
-
pathname
- The path string, which can be empty - Returns:
- A UnixDomainSocketAddress
- Throws:
-
InvalidPathException
- If the path cannot be converted to a Path
-
of
Create a UnixDomainSocketAddress for the given path.- Parameters:
-
path
- The path to the socket, which can be empty - Returns:
- A UnixDomainSocketAddress
- Throws:
-
IllegalArgumentException
- If the path is not associated with the default file system
-
getPath
Return this address's path.- Returns:
- this address's path
-
hashCode
public int hashCode()Returns the hash code of thisUnixDomainSocketAddress
- Overrides:
-
hashCode
in classObject
- Returns:
- a hash code value for this object.
- See Also:
-
Object.equals(java.lang.Object)
,System.identityHashCode(java.lang.Object)
-
equals
Compares this address with another object.- Overrides:
-
equals
in classObject
- Parameters:
-
o
- the reference object with which to compare. - Returns:
- true if the path fields are equal
- See Also:
-
Object.hashCode()
,HashMap
-
toString
Returns a string representation of thisUnixDomainSocketAddress
.
-