Home / Class/ MqttReasonCodes Class — netty Architecture

MqttReasonCodes Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  cc514075_e524_8f9f_37c4_ab32db4166fa["MqttReasonCodes"]
  c504338c_2902_e532_6aaa_70ad4dab253e["MqttReasonCodes.java"]
  cc514075_e524_8f9f_37c4_ab32db4166fa -->|defined in| c504338c_2902_e532_6aaa_70ad4dab253e
  159b9229_43af_83a0_debd_e178c32224ef["MqttReasonCodes()"]
  cc514075_e524_8f9f_37c4_ab32db4166fa -->|method| 159b9229_43af_83a0_debd_e178c32224ef
  0f33d78b_7971_76af_9e02_93f4459d1c5e["E()"]
  cc514075_e524_8f9f_37c4_ab32db4166fa -->|method| 0f33d78b_7971_76af_9e02_93f4459d1c5e

Relationship Graph

Source Code

codec-mqtt/src/main/java/io/netty/handler/codec/mqtt/MqttReasonCodes.java lines 22–422

public final class MqttReasonCodes {

    private MqttReasonCodes() {
    }

    /**
     * @return the corresponding enum value to the hex value.
     * */
    private static <E> E valueOfHelper(byte b, E[] values) {
        try {
            return values[b & 0xFF];
        } catch (ArrayIndexOutOfBoundsException e) {
            throw new IllegalArgumentException("unknown reason code: " + b);
        }
    }

    /**
     * Reason codes for MQTT Disconnect message.
     */
    public enum Disconnect {
        NORMAL_DISCONNECT((byte) 0x00), //sent by: client or server
        DISCONNECT_WITH_WILL_MESSAGE((byte) 0x04), //sent by: client
        UNSPECIFIED_ERROR((byte) 0x80), //sent by: client or server
        MALFORMED_PACKET((byte) 0x81), //sent by: client or server
        PROTOCOL_ERROR((byte) 0x82), //sent by: client or server
        IMPLEMENTATION_SPECIFIC_ERROR((byte) 0x83), //sent by: client or server
        NOT_AUTHORIZED((byte) 0x87), //sent by: server
        SERVER_BUSY((byte) 0x89), //sent by: server
        SERVER_SHUTTING_DOWN((byte) 0x8B), //sent by: server
        KEEP_ALIVE_TIMEOUT((byte) 0x8D), //sent by: Server
        SESSION_TAKEN_OVER((byte) 0x8E), //sent by: Server
        TOPIC_FILTER_INVALID((byte) 0x8F), //sent by: Server
        TOPIC_NAME_INVALID((byte) 0x90), //sent by: Client or Server
        RECEIVE_MAXIMUM_EXCEEDED((byte) 0x93), //sent by: Client or Server
        TOPIC_ALIAS_INVALID((byte) 0x94), //sent by: Client or Server
        PACKET_TOO_LARGE((byte) 0x95), //sent by: Client or Server
        MESSAGE_RATE_TOO_HIGH((byte) 0x96), //sent by: Client or Server
        QUOTA_EXCEEDED((byte) 0x97), //sent by: Client or Server
        ADMINISTRATIVE_ACTION((byte) 0x98), //sent by: Client or Server
        PAYLOAD_FORMAT_INVALID((byte) 0x99), //sent by: Client or Server
        RETAIN_NOT_SUPPORTED((byte) 0x9A), //sent by: Server
        QOS_NOT_SUPPORTED((byte) 0x9B), //sent by: Server
        USE_ANOTHER_SERVER((byte) 0x9C), //sent by: Server
        SERVER_MOVED((byte) 0x9D), //sent by: Server
        SHARED_SUBSCRIPTIONS_NOT_SUPPORTED((byte) 0x9E), //sent by: Server
        CONNECTION_RATE_EXCEEDED((byte) 0x9F), //sent by: Server
        MAXIMUM_CONNECT_TIME((byte) 0xA0), //sent by: Server
        SUBSCRIPTION_IDENTIFIERS_NOT_SUPPORTED((byte) 0xA1), //sent by: Server
        WILDCARD_SUBSCRIPTIONS_NOT_SUPPORTED((byte) 0xA2); //sent by: Server

        protected static final Disconnect[] VALUES;

        static {
            Disconnect[] values = values();
            VALUES = new Disconnect[163];
            for (Disconnect code : values) {
                final int unsignedByte = code.byteValue & 0xFF;
                // Suppress a warning about out of bounds access since the enum contains only correct values
                VALUES[unsignedByte] = code;    //  [java/index-out-of-bounds]
            }
        }

        private final byte byteValue;

        Disconnect(byte byteValue) {
            this.byteValue = byteValue;
        }

        /**
         * @return the value number corresponding to the constant.
         * */
        public byte byteValue() {
            return byteValue;
        }

        /**
         * @param b the number to decode.
         * @return the enum value corresponding to the number.
         * */
        public static Disconnect valueOf(byte b) {
            return valueOfHelper(b, VALUES);

Frequently Asked Questions

What is the MqttReasonCodes class?
MqttReasonCodes is a class in the netty codebase, defined in codec-mqtt/src/main/java/io/netty/handler/codec/mqtt/MqttReasonCodes.java.
Where is MqttReasonCodes defined?
MqttReasonCodes is defined in codec-mqtt/src/main/java/io/netty/handler/codec/mqtt/MqttReasonCodes.java at line 22.

Analyze Your Own Codebase

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

Try Supermodel Free