Home / Function/ encodeStringLiteral() — netty Function Reference

encodeStringLiteral() — netty Function Reference

Architecture documentation for the encodeStringLiteral() function in HpackEncoder.java from the netty codebase.

Function java Buffer Allocators calls 2 called by 1

Entity Profile

Dependency Diagram

graph TD
  772d7221_f578_9e4a_8e58_b93602d19372["encodeStringLiteral()"]
  616b4418_6852_a9a9_188d_063a8768b35a["HpackEncoder"]
  772d7221_f578_9e4a_8e58_b93602d19372 -->|defined in| 616b4418_6852_a9a9_188d_063a8768b35a
  23158887_3faf_9358_cf8e_ccef0456523f["encodeLiteral()"]
  23158887_3faf_9358_cf8e_ccef0456523f -->|calls| 772d7221_f578_9e4a_8e58_b93602d19372
  4cc85360_b269_0366_05e6_00fae09652a7["length()"]
  772d7221_f578_9e4a_8e58_b93602d19372 -->|calls| 4cc85360_b269_0366_05e6_00fae09652a7
  ff646124_1e6a_47c4_ccf7_8d4b7525d870["encodeInteger()"]
  772d7221_f578_9e4a_8e58_b93602d19372 -->|calls| ff646124_1e6a_47c4_ccf7_8d4b7525d870
  style 772d7221_f578_9e4a_8e58_b93602d19372 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http2/src/main/java/io/netty/handler/codec/http2/HpackEncoder.java lines 295–313

    private void encodeStringLiteral(ByteBuf out, CharSequence string) {
        int huffmanLength;
        if (string.length() >= huffCodeThreshold
          && (huffmanLength = hpackHuffmanEncoder.getEncodedLength(string)) < string.length()) {
            encodeInteger(out, 0x80, 7, huffmanLength);
            hpackHuffmanEncoder.encode(out, string);
        } else {
            encodeInteger(out, 0x00, 7, string.length());
            if (string instanceof AsciiString) {
                // Fast-path
                AsciiString asciiString = (AsciiString) string;
                out.writeBytes(asciiString.array(), asciiString.arrayOffset(), asciiString.length());
            } else {
                // Only ASCII is allowed in http2 headers, so it is fine to use this.
                // https://tools.ietf.org/html/rfc7540#section-8.1.2
                out.writeCharSequence(string, CharsetUtil.ISO_8859_1);
            }
        }
    }

Domain

Subdomains

Called By

Frequently Asked Questions

What does encodeStringLiteral() do?
encodeStringLiteral() is a function in the netty codebase, defined in codec-http2/src/main/java/io/netty/handler/codec/http2/HpackEncoder.java.
Where is encodeStringLiteral() defined?
encodeStringLiteral() is defined in codec-http2/src/main/java/io/netty/handler/codec/http2/HpackEncoder.java at line 295.
What does encodeStringLiteral() call?
encodeStringLiteral() calls 2 function(s): encodeInteger, length.
What calls encodeStringLiteral()?
encodeStringLiteral() is called by 1 function(s): encodeLiteral.

Analyze Your Own Codebase

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

Try Supermodel Free