Home / Function/ decodeByte() — netty Function Reference

decodeByte() — netty Function Reference

Architecture documentation for the decodeByte() function in JsonObjectDecoder.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  82cd9175_c986_585e_8ea2_00d1538388bd["decodeByte()"]
  cc9d6d69_638d_e1e7_aa08_bd1cacf4f8cc["JsonObjectDecoder"]
  82cd9175_c986_585e_8ea2_00d1538388bd -->|defined in| cc9d6d69_638d_e1e7_aa08_bd1cacf4f8cc
  e065d464_9fe4_dd94_1292_774ad1b9001b["decode()"]
  e065d464_9fe4_dd94_1292_774ad1b9001b -->|calls| 82cd9175_c986_585e_8ea2_00d1538388bd
  style 82cd9175_c986_585e_8ea2_00d1538388bd fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-base/src/main/java/io/netty/handler/codec/json/JsonObjectDecoder.java lines 193–221

    private void decodeByte(byte c, ByteBuf in, int idx) {
        if ((c == '{' || c == '[') && !insideString) {
            openBraces++;
        } else if ((c == '}' || c == ']') && !insideString) {
            openBraces--;
        } else if (c == '"') {
            // start of a new JSON string. It's necessary to detect strings as they may
            // also contain braces/brackets and that could lead to incorrect results.
            if (!insideString) {
                insideString = true;
            } else {
                int backslashCount = 0;
                idx--;
                while (idx >= 0) {
                    if (in.getByte(idx) == '\\') {
                        backslashCount++;
                        idx--;
                    } else {
                        break;
                    }
                }
                // The double quote isn't escaped only if there are even "\"s.
                if (backslashCount % 2 == 0) {
                    // Since the double quote isn't escaped then this is the end of a string.
                    insideString = false;
                }
            }
        }
    }

Domain

Subdomains

Called By

Frequently Asked Questions

What does decodeByte() do?
decodeByte() is a function in the netty codebase, defined in codec-base/src/main/java/io/netty/handler/codec/json/JsonObjectDecoder.java.
Where is decodeByte() defined?
decodeByte() is defined in codec-base/src/main/java/io/netty/handler/codec/json/JsonObjectDecoder.java at line 193.
What calls decodeByte()?
decodeByte() is called by 1 function(s): decode.

Analyze Your Own Codebase

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

Try Supermodel Free