Home / Function/ init() — netty Function Reference

init() — netty Function Reference

Architecture documentation for the init() function in Utf8EncodingBenchmark.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  9737e0a7_b59c_526f_e54f_aa40c2d6f750["init()"]
  14a7a416_5aef_2dc8_262c_52585d9f0cac["Utf8EncodingBenchmark"]
  9737e0a7_b59c_526f_e54f_aa40c2d6f750 -->|defined in| 14a7a416_5aef_2dc8_262c_52585d9f0cac
  e3dcd755_3549_c07b_1cd3_35d4d7d1f02e["AnotherCharSequence()"]
  9737e0a7_b59c_526f_e54f_aa40c2d6f750 -->|calls| e3dcd755_3549_c07b_1cd3_35d4d7d1f02e
  640e9533_bf6a_ebdd_f7f7_e4a05ca30d8a["length()"]
  9737e0a7_b59c_526f_e54f_aa40c2d6f750 -->|calls| 640e9533_bf6a_ebdd_f7f7_e4a05ca30d8a
  style 9737e0a7_b59c_526f_e54f_aa40c2d6f750 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

microbench/src/main/java/io/netty/microbench/buffer/Utf8EncodingBenchmark.java lines 90–122

    @Setup
    public void init() {
        System.setProperty("io.netty.noUnsafe", Boolean.valueOf(noUnsafe).toString());
        int maxExpectedSize = 0;
        List<String> strings = new ArrayList<String>();
        List<StringBuilder> stringBuilders = new ArrayList<StringBuilder>();
        List<AnotherCharSequence> anotherCharSequenceList = new ArrayList<AnotherCharSequence>();
        List<AsciiString> asciiStrings = new ArrayList<AsciiString>();
        try (InputStream testTextStream = getClass().getResourceAsStream("/Utf8Samples.txt");
             InputStreamReader inStreamReader = new InputStreamReader(testTextStream, "UTF-8");
             BufferedReader buffReader = new BufferedReader(inStreamReader);) {

            String line;
            while ((line = buffReader.readLine()) != null) {
                strings.add(line);
                stringBuilders.add(new StringBuilder(line));
                anotherCharSequenceList.add(new AnotherCharSequence(line));
                asciiStrings.add(new AsciiString(line));
                maxExpectedSize = Math.max(maxExpectedSize, ByteBufUtil.utf8MaxBytes(line.length()));
            }
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        buffer = direct? Unpooled.directBuffer(maxExpectedSize, maxExpectedSize) :
                Unpooled.buffer(maxExpectedSize, maxExpectedSize);
        buffer.setByte(maxExpectedSize - 1, 0);
        this.strings = strings.toArray(new String[strings.size()]);
        this.stringBuilders = stringBuilders.toArray(new StringBuilder[stringBuilders.size()]);
        this.anotherCharSequences =
                anotherCharSequenceList.toArray(new AnotherCharSequence[anotherCharSequenceList.size()]);
        this.asciiStrings = asciiStrings.toArray(new AsciiString[asciiStrings.size()]);
        this.dataSetLength = this.strings.length;
    }

Domain

Subdomains

Frequently Asked Questions

What does init() do?
init() is a function in the netty codebase, defined in microbench/src/main/java/io/netty/microbench/buffer/Utf8EncodingBenchmark.java.
Where is init() defined?
init() is defined in microbench/src/main/java/io/netty/microbench/buffer/Utf8EncodingBenchmark.java at line 90.
What does init() call?
init() calls 2 function(s): AnotherCharSequence, length.

Analyze Your Own Codebase

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

Try Supermodel Free