Package jnr.unixsocket
Class UnixSocketAddress
- java.lang.Object
-
- java.net.SocketAddress
-
- jnr.unixsocket.UnixSocketAddress
-
- All Implemented Interfaces:
java.io.Serializable
public class UnixSocketAddress extends java.net.SocketAddress
This class represents an AF_UNIX-style socket address. On Linux, it supports the platform-specific abstract name space.Using an abstract name space is denoted by the socket path starting with a NUL byte. Sockets in abstract name space have no entry in the file system. When linux performs autobind, it constructs the resulting path with a leading NUL, followed by a unique 5-digit hexadecimal number.
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private SockAddrUnix
address
private static long
serialVersionUID
-
Constructor Summary
Constructors Constructor Description UnixSocketAddress()
UnixSocketAddress(java.io.File path)
UnixSocketAddress(java.lang.String path)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object _other)
(package private) SockAddrUnix
getStruct()
int
hashCode()
java.lang.String
humanReadablePath()
Returns a human readable path.(package private) int
length()
java.lang.String
path()
Retrieves the path.private void
readObject(java.io.ObjectInputStream o)
java.lang.String
toString()
Retrieves a human readable description of this address.private void
writeObject(java.io.ObjectOutputStream o)
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
address
private transient SockAddrUnix address
-
-
Method Detail
-
getStruct
SockAddrUnix getStruct()
-
length
int length()
-
path
public java.lang.String path()
Retrieves the path.- Returns:
- The path of this AF_UNIX address. Note: On Linux, can contain a leading NUL byte, if this address resides in abstract namespace.
-
humanReadablePath
public java.lang.String humanReadablePath()
Returns a human readable path. On Linux, AF_UNIX sockets can be bound/connected in abstract namespace. This is denoted by a leading NUL byte in the path. In order to be properly displayed, this method returns a path prefixed by '@' like netstat, lsof an similar tools.- Returns:
- The human readable path of this address.
-
toString
public java.lang.String toString()
Retrieves a human readable description of this address.- Overrides:
toString
in classjava.lang.Object
- Returns:
- The human readable description of this address.
-
equals
public boolean equals(java.lang.Object _other)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
writeObject
private void writeObject(java.io.ObjectOutputStream o) throws java.io.IOException
- Throws:
java.io.IOException
-
readObject
private void readObject(java.io.ObjectInputStream o) throws java.io.IOException, java.lang.ClassNotFoundException
- Throws:
java.io.IOException
java.lang.ClassNotFoundException
-
-