Class AFUNIXSocketCredentials

java.lang.Object
org.newsclub.net.unix.AFUNIXSocketCredentials
All Implemented Interfaces:
Serializable

public final class AFUNIXSocketCredentials extends Object implements Serializable
AF_UNIX socket credentials.
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    Special instance, indicating that there is no remote peer, but the referenced object is from the same process.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    long
    Returns the primary "gid" (group ID), or -1 if it could not be retrieved.
    long[]
    Returns all "gid" values (group IDs), or null if they could not be retrieved.
    long
    Returns the "pid" (process ID), or -1 if it could not be retrieved.
    long
    Returns the "uid" (user ID), or -1 if it could not be retrieved.
    Returns the process' unique identifier, or null if no such identifier could be retrieved.
    int
     
    boolean
    Checks if neither of the possible peer credentials are set.
    Returns the AFUNIXSocketCredentials for the currently active remote session, or null if it was not possible to retrieve these credentials.
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • SAME_PROCESS

      public static final AFUNIXSocketCredentials 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 -1 if it could not be retrieved.
      Returns:
      The pid, or -1.
    • getUid

      public long getUid()
      Returns the "uid" (user ID), or -1 if it could not be retrieved.
      Returns:
      The uid, or -1.
    • getGid

      public long getGid()
      Returns the primary "gid" (group ID), or -1 if it could not be retrieved.
      Returns:
      The gid, or -1.
    • getGids

      public long[] getGids()
      Returns all "gid" values (group IDs), or null if 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 by getGid().
      Returns:
      The gids, or null.
    • getUUID

      public UUID getUUID()
      Returns the process' unique identifier, or null if 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:
      true if no credentials set.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • remotePeerCredentials

      public static AFUNIXSocketCredentials remotePeerCredentials()
      Returns the AFUNIXSocketCredentials for the currently active remote session, or null if 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 null if unable to retrieve.