Home / Function/ decodeLength() — netty Function Reference

decodeLength() — netty Function Reference

Architecture documentation for the decodeLength() function in RedisDecoder.java from the netty codebase.

Function java Buffer Allocators calls 3 called by 1

Entity Profile

Dependency Diagram

graph TD
  6d8b9b4b_2072_a961_76cb_8954875e821b["decodeLength()"]
  2421b439_cffa_67ca_b872_bb582dd0dbf2["RedisDecoder"]
  6d8b9b4b_2072_a961_76cb_8954875e821b -->|defined in| 2421b439_cffa_67ca_b872_bb582dd0dbf2
  04cf8633_8ce7_e5aa_352b_1b23a309052f["decode()"]
  04cf8633_8ce7_e5aa_352b_1b23a309052f -->|calls| 6d8b9b4b_2072_a961_76cb_8954875e821b
  24e865f9_bdd6_9dd8_56dc_9edb5828f082["parseRedisNumber()"]
  6d8b9b4b_2072_a961_76cb_8954875e821b -->|calls| 24e865f9_bdd6_9dd8_56dc_9edb5828f082
  fe09be93_7a87_7d9a_a4e2_1f26488d2f56["resetDecoder()"]
  6d8b9b4b_2072_a961_76cb_8954875e821b -->|calls| fe09be93_7a87_7d9a_a4e2_1f26488d2f56
  1d4f1b51_c148_ce38_593c_4e951cf4f9b6["decodeBulkString()"]
  6d8b9b4b_2072_a961_76cb_8954875e821b -->|calls| 1d4f1b51_c148_ce38_593c_4e951cf4f9b6
  style 6d8b9b4b_2072_a961_76cb_8954875e821b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-redis/src/main/java/io/netty/handler/codec/redis/RedisDecoder.java lines 169–193

    private boolean decodeLength(ByteBuf in, List<Object> out) throws Exception {
        ByteBuf lineByteBuf = readLine(in);
        if (lineByteBuf == null) {
            return false;
        }
        final long length = parseRedisNumber(lineByteBuf);
        if (length < RedisConstants.NULL_VALUE) {
            throw new RedisCodecException("length: " + length + " (expected: >= " + RedisConstants.NULL_VALUE + ")");
        }
        switch (type) {
        case ARRAY_HEADER:
            out.add(new ArrayHeaderRedisMessage(length));
            resetDecoder();
            return true;
        case BULK_STRING:
            if (length > RedisConstants.REDIS_MESSAGE_MAX_LENGTH) {
                throw new RedisCodecException("length: " + length + " (expected: <= " +
                                              RedisConstants.REDIS_MESSAGE_MAX_LENGTH + ")");
            }
            remainingBulkLength = (int) length; // range(int) is already checked.
            return decodeBulkString(in, out);
        default:
            throw new RedisCodecException("bad type: " + type);
        }
    }

Domain

Subdomains

Called By

Frequently Asked Questions

What does decodeLength() do?
decodeLength() is a function in the netty codebase, defined in codec-redis/src/main/java/io/netty/handler/codec/redis/RedisDecoder.java.
Where is decodeLength() defined?
decodeLength() is defined in codec-redis/src/main/java/io/netty/handler/codec/redis/RedisDecoder.java at line 169.
What does decodeLength() call?
decodeLength() calls 3 function(s): decodeBulkString, parseRedisNumber, resetDecoder.
What calls decodeLength()?
decodeLength() 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