Home / File/ HashCollisionTest.java — netty Source File

HashCollisionTest.java — netty Source File

Architecture documentation for HashCollisionTest.java, a java file in the netty codebase.

Entity Profile

Relationship Graph

Source Code

/*
 * Copyright 2016 The Netty Project
 *
 * The Netty Project licenses this file to you under the Apache License, version 2.0 (the
 * "License"); you may not use this file except in compliance with the License. You may obtain a
 * copy of the License at:
 *
 * https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */
package io.netty.handler.codec.http2;

import io.netty.handler.codec.http.HttpHeaderNames;
import io.netty.handler.codec.http.HttpHeaderValues;
import io.netty.util.AsciiString;
import io.netty.util.internal.PlatformDependent;
import org.junit.jupiter.api.Disabled;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintStream;
import java.lang.reflect.Field;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

@Disabled
public final class HashCollisionTest {
    private HashCollisionTest() { }

    public static void main(String[] args) throws IllegalAccessException, IOException, URISyntaxException {
        // Big initial size for when all name sources are pulled in.
        List<CharSequence> strings = new ArrayList<CharSequence>(350000);
        addHttpHeaderNames(strings);
        addHttpHeaderValues(strings);
        addHttp2HeaderNames(strings);
        addWordsFromFile(new File("/usr/share/dict/words"), strings);
        // More "english words" can be found here:
        // https://gist.github.com/Scottmitch/de2f03912778016ecee3c140478f07e0#file-englishwords-txt

        Map<Integer, List<CharSequence>> dups = calculateDuplicates(strings, new Function<CharSequence, Integer>() {
            @Override
            public Integer apply(CharSequence string) {
                int h = 0;
                for (int i = 0; i < string.length(); ++i) {
                    // masking with 0x1F reduces the number of overall bits that impact the hash code but makes the hash
                    // code the same regardless of character case (upper case or lower case hash is the same).
// ... (118 more lines)

Domain

Subdomains

Types

Frequently Asked Questions

What does HashCollisionTest.java do?
HashCollisionTest.java is a source file in the netty codebase, written in java. It belongs to the Buffer domain, Allocators subdomain.
Where is HashCollisionTest.java in the architecture?
HashCollisionTest.java is located at codec-http2/src/test/java/io/netty/handler/codec/http2/HashCollisionTest.java (domain: Buffer, subdomain: Allocators, directory: codec-http2/src/test/java/io/netty/handler/codec/http2).

Analyze Your Own Codebase

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

Try Supermodel Free