Home / Class/ Socks4CommandType Class — netty Architecture

Socks4CommandType Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  6dff65a7_58e4_a7d5_e7a4_32ea96dc35e5["Socks4CommandType"]
  4008d40c_06af_d9c9_5845_0c2f23fa4888["Socks4CommandType.java"]
  6dff65a7_58e4_a7d5_e7a4_32ea96dc35e5 -->|defined in| 4008d40c_06af_d9c9_5845_0c2f23fa4888
  40490168_3d9e_c0c1_53d5_5b4fd28a1b88["Socks4CommandType()"]
  6dff65a7_58e4_a7d5_e7a4_32ea96dc35e5 -->|method| 40490168_3d9e_c0c1_53d5_5b4fd28a1b88
  90d9885a_7f83_212a_d00e_127d054b8cf0["byteValue()"]
  6dff65a7_58e4_a7d5_e7a4_32ea96dc35e5 -->|method| 90d9885a_7f83_212a_d00e_127d054b8cf0
  d2a02d46_9a34_bf1f_ecac_4e70244d6c68["hashCode()"]
  6dff65a7_58e4_a7d5_e7a4_32ea96dc35e5 -->|method| d2a02d46_9a34_bf1f_ecac_4e70244d6c68
  deb7bde7_907a_9c90_1c49_9c9aa50d35f1["equals()"]
  6dff65a7_58e4_a7d5_e7a4_32ea96dc35e5 -->|method| deb7bde7_907a_9c90_1c49_9c9aa50d35f1
  c55e31a5_11de_2faa_88fd_5dd64ce21d67["compareTo()"]
  6dff65a7_58e4_a7d5_e7a4_32ea96dc35e5 -->|method| c55e31a5_11de_2faa_88fd_5dd64ce21d67
  13c26a78_87c9_3b26_d26b_b8571e869a5f["String()"]
  6dff65a7_58e4_a7d5_e7a4_32ea96dc35e5 -->|method| 13c26a78_87c9_3b26_d26b_b8571e869a5f

Relationship Graph

Source Code

codec-socks/src/main/java/io/netty/handler/codec/socksx/v4/Socks4CommandType.java lines 23–83

public class Socks4CommandType implements Comparable<Socks4CommandType> {

    public static final Socks4CommandType CONNECT = new Socks4CommandType(0x01, "CONNECT");
    public static final Socks4CommandType BIND = new Socks4CommandType(0x02, "BIND");

    public static Socks4CommandType valueOf(byte b) {
        switch (b) {
        case 0x01:
            return CONNECT;
        case 0x02:
            return BIND;
        }

        return new Socks4CommandType(b);
    }

    private final byte byteValue;
    private final String name;
    private String text;

    public Socks4CommandType(int byteValue) {
        this(byteValue, "UNKNOWN");
    }

    public Socks4CommandType(int byteValue, String name) {
        this.name = ObjectUtil.checkNotNull(name, "name");
        this.byteValue = (byte) byteValue;
    }

    public byte byteValue() {
        return byteValue;
    }

    @Override
    public int hashCode() {
        return byteValue;
    }

    @Override
    public boolean equals(Object obj) {
        if (!(obj instanceof Socks4CommandType)) {
            return false;
        }

        return byteValue == ((Socks4CommandType) obj).byteValue;
    }

    @Override
    public int compareTo(Socks4CommandType o) {
        return byteValue - o.byteValue;
    }

    @Override
    public String toString() {
        String text = this.text;
        if (text == null) {
            this.text = text = name + '(' + (byteValue & 0xFF) + ')';
        }
        return text;
    }
}

Frequently Asked Questions

What is the Socks4CommandType class?
Socks4CommandType is a class in the netty codebase, defined in codec-socks/src/main/java/io/netty/handler/codec/socksx/v4/Socks4CommandType.java.
Where is Socks4CommandType defined?
Socks4CommandType is defined in codec-socks/src/main/java/io/netty/handler/codec/socksx/v4/Socks4CommandType.java at line 23.

Analyze Your Own Codebase

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

Try Supermodel Free