Home / Class/ PeerCredentials Class — netty Architecture

PeerCredentials Class — netty Architecture

Architecture documentation for the PeerCredentials class in PeerCredentials.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  dc738de0_8737_9b9a_893c_40415988d2a1["PeerCredentials"]
  e48eed81_13a0_0482_be86_69dabec157d0["PeerCredentials.java"]
  dc738de0_8737_9b9a_893c_40415988d2a1 -->|defined in| e48eed81_13a0_0482_be86_69dabec157d0
  dc7b3fb2_47c1_8c2c_8de1_b99206efcb80["PeerCredentials()"]
  dc738de0_8737_9b9a_893c_40415988d2a1 -->|method| dc7b3fb2_47c1_8c2c_8de1_b99206efcb80
  5834a185_7b6b_6736_f902_d0691f90843f["pid()"]
  dc738de0_8737_9b9a_893c_40415988d2a1 -->|method| 5834a185_7b6b_6736_f902_d0691f90843f
  a858692a_d297_6fb5_7ed7_84fad880890b["uid()"]
  dc738de0_8737_9b9a_893c_40415988d2a1 -->|method| a858692a_d297_6fb5_7ed7_84fad880890b
  b062507a_702c_8152_4d4f_a2d9be799fdc["gids()"]
  dc738de0_8737_9b9a_893c_40415988d2a1 -->|method| b062507a_702c_8152_4d4f_a2d9be799fdc
  9d014d5b_359b_02c0_3e43_3e8e4e35b977["String()"]
  dc738de0_8737_9b9a_893c_40415988d2a1 -->|method| 9d014d5b_359b_02c0_3e43_3e8e4e35b977

Relationship Graph

Source Code

transport-native-unix-common/src/main/java/io/netty/channel/unix/PeerCredentials.java lines 30–74

@UnstableApi
public final class PeerCredentials {
    private final int pid;
    private final int uid;
    private final int[] gids;

    // These values are set by JNI via Socket.peerCredentials()
    PeerCredentials(int p, int u, int... gids) {
        pid = p;
        uid = u;
        this.gids = gids == null ? EMPTY_INTS : gids;
    }

    /**
     * Get the PID of the peer process.
     * <p>
     * This is currently not populated on MacOS and BSD based systems.
     * @return The PID of the peer process.
     */
    public int pid() {
        return pid;
    }

    public int uid() {
        return uid;
    }

    public int[] gids() {
        return gids.clone();
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder(128);
        sb.append("UserCredentials[pid=").append(pid).append("; uid=").append(uid).append("; gids=[");
        if (gids.length > 0) {
            sb.append(gids[0]);
            for (int i = 1; i < gids.length; ++i) {
                sb.append(", ").append(gids[i]);
            }
        }
        sb.append(']');
        return sb.toString();
    }
}

Frequently Asked Questions

What is the PeerCredentials class?
PeerCredentials is a class in the netty codebase, defined in transport-native-unix-common/src/main/java/io/netty/channel/unix/PeerCredentials.java.
Where is PeerCredentials defined?
PeerCredentials is defined in transport-native-unix-common/src/main/java/io/netty/channel/unix/PeerCredentials.java at line 30.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free