java.lang.Object
org.newsclub.net.unix.AFUNIXSocketCredentials
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final AFUNIXSocketCredentialsSpecial instance, indicating that there is no remote peer, but the referenced object is from the same process. -
Method Summary
Modifier and TypeMethodDescriptionbooleanlonggetGid()Returns the primary "gid" (group ID), or-1if it could not be retrieved.long[]getGids()Returns all "gid" values (group IDs), ornullif they could not be retrieved.longgetPid()Returns the "pid" (process ID), or-1if it could not be retrieved.longgetUid()Returns the "uid" (user ID), or-1if it could not be retrieved.getUUID()Returns the process' unique identifier, ornullif no such identifier could be retrieved.inthashCode()booleanisEmpty()Checks if neither of the possible peer credentials are set.static AFUNIXSocketCredentialsReturns theAFUNIXSocketCredentialsfor the currently active remote session, ornullif it was not possible to retrieve these credentials.toString()
-
Field Details
-
SAME_PROCESS
Special instance, indicating that there is no remote peer, but the referenced object is from the same process.
-
-
Method Details
-
getPid
public long getPid()Returns the "pid" (process ID), or-1if it could not be retrieved.- Returns:
- The pid, or -1.
-
getUid
public long getUid()Returns the "uid" (user ID), or-1if it could not be retrieved.- Returns:
- The uid, or -1.
-
getGid
public long getGid()Returns the primary "gid" (group ID), or-1if it could not be retrieved.- Returns:
- The gid, or -1.
-
getGids
public long[] getGids()Returns all "gid" values (group IDs), ornullif they could not be retrieved. Note that this list may be incomplete (only the primary gid may be returned), but it is guaranteed that the first one in the list is the primary gid as returned bygetGid().- Returns:
- The gids, or null.
-
getUUID
Returns the process' unique identifier, ornullif no such identifier could be retrieved. Note that all processes run by the same Java runtime may share the same UUID.- Returns:
- The UUID, or null.
-
isEmpty
public boolean isEmpty()Checks if neither of the possible peer credentials are set.- Returns:
trueif no credentials set.
-
toString
-
hashCode
-
equals
-
remotePeerCredentials
Returns theAFUNIXSocketCredentialsfor the currently active remote session, ornullif it was not possible to retrieve these credentials. NOTE: For now, only RMI remote sessions are supported (RemoteServer sessions during a remote method invocation). If you want to retrieve the peer credentials for an RMI server, see junixsocket-rmi's RemotePeerInfo.- Returns:
- The credentials, or
nullif unable to retrieve.
-