Home / Function/ String() — netty Function Reference

String() — netty Function Reference

Architecture documentation for the String() function in WebSocketClientHandshaker00.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  9abda4ea_6c31_e490_a5d3_7d8575bc694f["String()"]
  65386c76_5fdd_9bc6_905a_654742368a12["WebSocketClientHandshaker00"]
  9abda4ea_6c31_e490_a5d3_7d8575bc694f -->|defined in| 65386c76_5fdd_9bc6_905a_654742368a12
  style 9abda4ea_6c31_e490_a5d3_7d8575bc694f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshaker00.java lines 290–311

    private static String insertRandomCharacters(String key) {
        int count = WebSocketUtil.randomNumber(1, 12);

        char[] randomChars = new char[count];
        int randCount = 0;
        while (randCount < count) {
            int rand = ThreadLocalRandom.current().nextInt(0x7e) + 0x21;
            if (0x21 < rand && rand < 0x2f || 0x3a < rand && rand < 0x7e) {
                randomChars[randCount] = (char) rand;
                randCount += 1;
            }
        }

        for (int i = 0; i < count; i++) {
            int split = WebSocketUtil.randomNumber(0, key.length());
            String part1 = key.substring(0, split);
            String part2 = key.substring(split);
            key = part1 + randomChars[i] + part2;
        }

        return key;
    }

Subdomains

Frequently Asked Questions

What does String() do?
String() is a function in the netty codebase, defined in codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshaker00.java.
Where is String() defined?
String() is defined in codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshaker00.java at line 290.

Analyze Your Own Codebase

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

Try Supermodel Free