Top Description Fields Constructors Methods
org.newsclub.net.unix

public final Class AFUNIXSocketCredentials

extends Object
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Imports
java.io.IOException, .Serializable, java.net.Socket, java.rmi.server.RemoteServer, java.util.Arrays, .UUID

AF_UNIX socket credentials.
See Also
AFUNIXSocket#getPeerCredentials()

Field Summary

Modifier and TypeField and Description
private long[]
gids

All GID values (or null for "not set"); the first being the primary one.

private long
pid

The PID, or -1 for "not set".

public static final AFUNIXSocketCredentials
SAME_PROCESS

Special instance, indicating that there is no remote peer, but the referenced object is from the same process.

private static final long
private long
uid

The UID, or -1 for "not set".

private UUID
uuid

The UUID, or null for "not set".

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public long

Returns:

The gid, or -1.
getGid
()

Returns the primary "gid" (group ID), or -1 if it could not be retrieved.

public long[]

Returns:

The gids, or null.
getGids
()

Returns all "gid" values (group IDs), or null if they could not be retrieved.

public long

Returns:

The pid, or -1.
getPid
()

Returns the "pid" (process ID), or -1 if it could not be retrieved.

public long

Returns:

The uid, or -1.
getUid
()

Returns the "uid" (user ID), or -1 if it could not be retrieved.

public UUID

Returns:

The UUID, or null.
getUUID
()

Returns the process' unique identifier, or null if no such identifier could be retrieved.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public boolean

Returns:

true if no credentials set.
isEmpty
()

Checks if neither of the possible peer credentials are set.

public static AFUNIXSocketCredentials

Returns:

The credentials, or null if unable to retrieve.
remotePeerCredentials
()

Returns the AFUNIXSocketCredentials for the currently active remote session, or null if it was not possible to retrieve these credentials.

pack-priv void
setGids(long[] gids)

pack-priv void
setUUID(String uuidStr)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

gidsback to summary
private long[] gids

All GID values (or null for "not set"); the first being the primary one.

pidback to summary
private long pid

The PID, or -1 for "not set".

SAME_PROCESSback to summary
public static final AFUNIXSocketCredentials SAME_PROCESS

Special instance, indicating that there is no remote peer, but the referenced object is from the same process.

serialVersionUIDback to summary
private static final long serialVersionUID
uidback to summary
private long uid

The UID, or -1 for "not set".

uuidback to summary
private UUID uuid

The UUID, or null for "not set".

Constructor Detail

AFUNIXSocketCredentialsback to summary
pack-priv AFUNIXSocketCredentials()

Method Detail

equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
@SuppressWarnings:all
getGidback to summary
public long getGid()

Returns the primary "gid" (group ID), or -1 if it could not be retrieved.

Returns:long

The gid, or -1.

getGidsback to summary
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:long[]

The gids, or null.

getPidback to summary
public long getPid()

Returns the "pid" (process ID), or -1 if it could not be retrieved.

Returns:long

The pid, or -1.

getUidback to summary
public long getUid()

Returns the "uid" (user ID), or -1 if it could not be retrieved.

Returns:long

The uid, or -1.

getUUIDback to summary
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:UUID

The UUID, or null.

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
isEmptyback to summary
public boolean isEmpty()

Checks if neither of the possible peer credentials are set.

Returns:boolean

true if no credentials set.

remotePeerCredentialsback to summary
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:AFUNIXSocketCredentials

The credentials, or null if unable to retrieve.

setGidsback to summary
pack-priv void setGids(long[] gids)
setUUIDback to summary
pack-priv void setUUID(String uuidStr)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override