Package jnr.unixsocket
Class Credentials
- java.lang.Object
-
- jnr.unixsocket.Credentials
-
public final class Credentials extends java.lang.ObjectThis class represents the peer credentials, retrievable from an AF_UNIX socket.An instance of this class can be retrieved, using either the socket-level methods
UnixSocket.getCredentials()andUnixDatagramSocket.getCredentials()or by specifyingUnixSocketOptions.SO_PEERCREDas argument to one of the channel-level methodsUnixSocketChannel.getOption(java.net.SocketOption<T>)andUnixDatagramChannel.getOption(java.net.SocketOption<T>).See also: socket (7)
-
-
Constructor Summary
Constructors Constructor Description Credentials(Ucred ucred)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) static CredentialsgetCredentials(int fd)intgetGid()Retrieves the peer's numeric effective group ID.intgetPid()Retrieves the peer's process ID.intgetUid()Retrieves the peer's numeric effective user ID.java.lang.StringtoString()Returns a human readable description of this instance.
-
-
-
Field Detail
-
ucred
private final Ucred ucred
-
-
Constructor Detail
-
Credentials
Credentials(Ucred ucred)
-
-
Method Detail
-
getPid
public int getPid()
Retrieves the peer's process ID.- Returns:
- The PID.
-
getUid
public int getUid()
Retrieves the peer's numeric effective user ID.- Returns:
- The EUID.
-
getGid
public int getGid()
Retrieves the peer's numeric effective group ID.- Returns:
- The EGID.
-
toString
public java.lang.String toString()
Returns a human readable description of this instance.- Overrides:
toStringin classjava.lang.Object
-
getCredentials
static Credentials getCredentials(int fd)
-
-