Home / Function/ getChunkSize() — netty Function Reference

getChunkSize() — netty Function Reference

Architecture documentation for the getChunkSize() function in HttpObjectDecoder.java from the netty codebase.

Function java ProtocolCodecs HTTP calls 2 called by 1

Entity Profile

Dependency Diagram

graph TD
  2b1be95c_cb2c_f7ea_5d2f_cb97065fa253["getChunkSize()"]
  6c551372_1bb2_fe27_3884_c4cc297c86ae["HttpObjectDecoder"]
  2b1be95c_cb2c_f7ea_5d2f_cb97065fa253 -->|defined in| 6c551372_1bb2_fe27_3884_c4cc297c86ae
  3a54a7e3_c206_fca7_1bb4_d8176ccd19cb["decode()"]
  3a54a7e3_c206_fca7_1bb4_d8176ccd19cb -->|calls| 2b1be95c_cb2c_f7ea_5d2f_cb97065fa253
  d06a3a39_72c4_0e85_ab60_aab7ffeec2f0["skipWhiteSpaces()"]
  2b1be95c_cb2c_f7ea_5d2f_cb97065fa253 -->|calls| d06a3a39_72c4_0e85_ab60_aab7ffeec2f0
  6696e64c_b543_c1bd_c8f5_9a0611f1bd22["isControlOrWhitespaceAsciiChar()"]
  2b1be95c_cb2c_f7ea_5d2f_cb97065fa253 -->|calls| 6696e64c_b543_c1bd_c8f5_9a0611f1bd22
  style 2b1be95c_cb2c_f7ea_5d2f_cb97065fa253 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http/src/main/java/io/netty/handler/codec/http/HttpObjectDecoder.java lines 928–960

    private static int getChunkSize(byte[] hex, int start, int length) {
        // trim the leading bytes if white spaces, if any
        final int skipped = skipWhiteSpaces(hex, start, length);
        if (skipped == length) {
            // empty case
            throw new NumberFormatException();
        }
        start += skipped;
        length -= skipped;
        int result = 0;
        for (int i = 0; i < length; i++) {
            final int digit = StringUtil.decodeHexNibble(hex[start + i]);
            if (digit == -1) {
                // uncommon path
                final byte b = hex[start + i];
                if (b == ';' || isControlOrWhitespaceAsciiChar(b)) {
                    if (i == 0) {
                        // empty case
                        throw new NumberFormatException("Empty chunk size");
                    }
                    return result;
                }
                // non-hex char fail-fast path
                throw new NumberFormatException("Invalid character in chunk size");
            }
            result *= 16;
            result += digit;
            if (result < 0) {
                throw new NumberFormatException("Chunk size overflow: " + result);
            }
        }
        return result;
    }

Subdomains

Called By

Frequently Asked Questions

What does getChunkSize() do?
getChunkSize() is a function in the netty codebase, defined in codec-http/src/main/java/io/netty/handler/codec/http/HttpObjectDecoder.java.
Where is getChunkSize() defined?
getChunkSize() is defined in codec-http/src/main/java/io/netty/handler/codec/http/HttpObjectDecoder.java at line 928.
What does getChunkSize() call?
getChunkSize() calls 2 function(s): isControlOrWhitespaceAsciiChar, skipWhiteSpaces.
What calls getChunkSize()?
getChunkSize() 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