Home / Function/ decodeProperties() — netty Function Reference

decodeProperties() — netty Function Reference

Architecture documentation for the decodeProperties() function in MqttDecoder.java from the netty codebase.

Function java Buffer Allocators calls 6 called by 7

Entity Profile

Dependency Diagram

graph TD
  8cad50bc_08ed_5075_a0f7_de30f00ba977["decodeProperties()"]
  c4faa729_e212_a3dd_9d90_3e8fd908d755["MqttDecoder"]
  8cad50bc_08ed_5075_a0f7_de30f00ba977 -->|defined in| c4faa729_e212_a3dd_9d90_3e8fd908d755
  011991cc_195a_5e24_a498_8df8267d825e["MqttConnectVariableHeader()"]
  011991cc_195a_5e24_a498_8df8267d825e -->|calls| 8cad50bc_08ed_5075_a0f7_de30f00ba977
  ce7a49f3_246f_2440_f1c6_01af3e368c37["MqttConnAckVariableHeader()"]
  ce7a49f3_246f_2440_f1c6_01af3e368c37 -->|calls| 8cad50bc_08ed_5075_a0f7_de30f00ba977
  56e49442_12c5_b9e5_14d7_23d73dd802d2["MqttMessageIdAndPropertiesVariableHeader()"]
  56e49442_12c5_b9e5_14d7_23d73dd802d2 -->|calls| 8cad50bc_08ed_5075_a0f7_de30f00ba977
  8b19608c_9ee3_40f3_5402_e745fcea4448["MqttPubReplyMessageVariableHeader()"]
  8b19608c_9ee3_40f3_5402_e745fcea4448 -->|calls| 8cad50bc_08ed_5075_a0f7_de30f00ba977
  fc3166bc_2c32_c8b7_e203_32d9c6648fa1["MqttReasonCodeAndPropertiesVariableHeader()"]
  fc3166bc_2c32_c8b7_e203_32d9c6648fa1 -->|calls| 8cad50bc_08ed_5075_a0f7_de30f00ba977
  c4f45191_2a53_efcc_39c7_8365c184d7db["MqttPublishVariableHeader()"]
  c4f45191_2a53_efcc_39c7_8365c184d7db -->|calls| 8cad50bc_08ed_5075_a0f7_de30f00ba977
  05955631_9ad1_8193_ccef_2c8870319b81["MqttConnectPayload()"]
  05955631_9ad1_8193_ccef_2c8870319b81 -->|calls| 8cad50bc_08ed_5075_a0f7_de30f00ba977
  12d15f6d_1e3a_b75b_353d_a5cbfc12349a["decodeVariableByteInteger()"]
  8cad50bc_08ed_5075_a0f7_de30f00ba977 -->|calls| 12d15f6d_1e3a_b75b_353d_a5cbfc12349a
  81331d46_da4b_2507_044f_ed6c72df4169["unpackA()"]
  8cad50bc_08ed_5075_a0f7_de30f00ba977 -->|calls| 81331d46_da4b_2507_044f_ed6c72df4169
  7a546bcf_a7a0_56b3_4b9e_1bad3f2396bc["unpackB()"]
  8cad50bc_08ed_5075_a0f7_de30f00ba977 -->|calls| 7a546bcf_a7a0_56b3_4b9e_1bad3f2396bc
  c329612b_da71_6e39_b716_e4f7dc59569d["decodeMsbLsb()"]
  8cad50bc_08ed_5075_a0f7_de30f00ba977 -->|calls| c329612b_da71_6e39_b716_e4f7dc59569d
  98ef5a77_12ad_c763_de85_bb9068059363["decodeString()"]
  8cad50bc_08ed_5075_a0f7_de30f00ba977 -->|calls| 98ef5a77_12ad_c763_de85_bb9068059363
  1cb12c52_1d9a_4252_9803_cdf9ef0e087a["decodeByteArray()"]
  8cad50bc_08ed_5075_a0f7_de30f00ba977 -->|calls| 1cb12c52_1d9a_4252_9803_cdf9ef0e087a
  style 8cad50bc_08ed_5075_a0f7_de30f00ba977 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-mqtt/src/main/java/io/netty/handler/codec/mqtt/MqttDecoder.java lines 761–836

    private static Result<MqttProperties> decodeProperties(ByteBuf buffer) {
        final long propertiesLength = decodeVariableByteInteger(buffer);
        int totalPropertiesLength = unpackA(propertiesLength);
        int numberOfBytesConsumed = unpackB(propertiesLength);

        MqttProperties decodedProperties = new MqttProperties();
        while (numberOfBytesConsumed < totalPropertiesLength) {
            long propertyId = decodeVariableByteInteger(buffer);
            final int propertyIdValue = unpackA(propertyId);
            numberOfBytesConsumed += unpackB(propertyId);
            switch (propertyIdValue) {
                case PAYLOAD_FORMAT_INDICATOR:
                case REQUEST_PROBLEM_INFORMATION:
                case REQUEST_RESPONSE_INFORMATION:
                case MAXIMUM_QOS:
                case RETAIN_AVAILABLE:
                case WILDCARD_SUBSCRIPTION_AVAILABLE:
                case SUBSCRIPTION_IDENTIFIER_AVAILABLE:
                case SHARED_SUBSCRIPTION_AVAILABLE:
                    final int b1 = buffer.readUnsignedByte();
                    numberOfBytesConsumed++;
                    decodedProperties.add(new IntegerProperty(propertyIdValue, b1));
                    break;
                case SERVER_KEEP_ALIVE:
                case RECEIVE_MAXIMUM:
                case TOPIC_ALIAS_MAXIMUM:
                case TOPIC_ALIAS:
                    final int int2BytesResult = decodeMsbLsb(buffer);
                    numberOfBytesConsumed += 2;
                    decodedProperties.add(new IntegerProperty(propertyIdValue, int2BytesResult));
                    break;
                case PUBLICATION_EXPIRY_INTERVAL:
                case SESSION_EXPIRY_INTERVAL:
                case WILL_DELAY_INTERVAL:
                case MAXIMUM_PACKET_SIZE:
                    final int maxPacketSize = buffer.readInt();
                    numberOfBytesConsumed += 4;
                    decodedProperties.add(new IntegerProperty(propertyIdValue, maxPacketSize));
                    break;
                case SUBSCRIPTION_IDENTIFIER:
                    long vbIntegerResult = decodeVariableByteInteger(buffer);
                    numberOfBytesConsumed += unpackB(vbIntegerResult);
                    decodedProperties.add(new IntegerProperty(propertyIdValue, unpackA(vbIntegerResult)));
                    break;
                case CONTENT_TYPE:
                case RESPONSE_TOPIC:
                case ASSIGNED_CLIENT_IDENTIFIER:
                case AUTHENTICATION_METHOD:
                case RESPONSE_INFORMATION:
                case SERVER_REFERENCE:
                case REASON_STRING:
                    final Result<String> stringResult = decodeString(buffer);
                    numberOfBytesConsumed += stringResult.numberOfBytesConsumed;
                    decodedProperties.add(new MqttProperties.StringProperty(propertyIdValue, stringResult.value));
                    break;
                case USER_PROPERTY:
                    final Result<String> keyResult = decodeString(buffer);
                    final Result<String> valueResult = decodeString(buffer);
                    numberOfBytesConsumed += keyResult.numberOfBytesConsumed;
                    numberOfBytesConsumed += valueResult.numberOfBytesConsumed;
                    decodedProperties.add(new MqttProperties.UserProperty(keyResult.value, valueResult.value));
                    break;
                case CORRELATION_DATA:
                case AUTHENTICATION_DATA:
                    final byte[] binaryDataResult = decodeByteArray(buffer);
                    numberOfBytesConsumed += binaryDataResult.length + 2;
                    decodedProperties.add(new MqttProperties.BinaryProperty(propertyIdValue, binaryDataResult));
                    break;
                default:
                    //shouldn't reach here
                    throw new DecoderException("Unknown property type: " + propertyIdValue);
            }
        }

        return new Result<MqttProperties>(decodedProperties, numberOfBytesConsumed);
    }

Domain

Subdomains

Frequently Asked Questions

What does decodeProperties() do?
decodeProperties() is a function in the netty codebase, defined in codec-mqtt/src/main/java/io/netty/handler/codec/mqtt/MqttDecoder.java.
Where is decodeProperties() defined?
decodeProperties() is defined in codec-mqtt/src/main/java/io/netty/handler/codec/mqtt/MqttDecoder.java at line 761.
What does decodeProperties() call?
decodeProperties() calls 6 function(s): decodeByteArray, decodeMsbLsb, decodeString, decodeVariableByteInteger, unpackA, unpackB.
What calls decodeProperties()?
decodeProperties() is called by 7 function(s): MqttConnAckVariableHeader, MqttConnectPayload, MqttConnectVariableHeader, MqttMessageIdAndPropertiesVariableHeader, MqttPubReplyMessageVariableHeader, MqttPublishVariableHeader, MqttReasonCodeAndPropertiesVariableHeader.

Analyze Your Own Codebase

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

Try Supermodel Free