Home / Function/ equals() — netty Function Reference

equals() — netty Function Reference

Architecture documentation for the equals() function in ByteBufUtil.java from the netty codebase.

Function java Buffer Search calls 1 called by 3

Entity Profile

Dependency Diagram

graph TD
  c05c9b3e_b2a3_295c_5eb2_a427df9e1f52["equals()"]
  920454f6_25f6_4a9b_3d32_9684c3e11f6c["ByteBufUtil"]
  c05c9b3e_b2a3_295c_5eb2_a427df9e1f52 -->|defined in| 920454f6_25f6_4a9b_3d32_9684c3e11f6c
  01cd6f08_cabc_df56_318f_9666e83f47c5["indexOf()"]
  01cd6f08_cabc_df56_318f_9666e83f47c5 -->|calls| c05c9b3e_b2a3_295c_5eb2_a427df9e1f52
  96cdf8e2_4e5f_72af_07c1_cc29b6248734["String()"]
  96cdf8e2_4e5f_72af_07c1_cc29b6248734 -->|calls| c05c9b3e_b2a3_295c_5eb2_a427df9e1f52
  7654d22c_0971_21b4_bffe_e987b65afc12["isText()"]
  7654d22c_0971_21b4_bffe_e987b65afc12 -->|calls| c05c9b3e_b2a3_295c_5eb2_a427df9e1f52
  24c6c591_8268_6663_f794_78e3670bc2ac["swapLong()"]
  c05c9b3e_b2a3_295c_5eb2_a427df9e1f52 -->|calls| 24c6c591_8268_6663_f794_78e3670bc2ac
  style c05c9b3e_b2a3_295c_5eb2_a427df9e1f52 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

buffer/src/main/java/io/netty/buffer/ByteBufUtil.java lines 366–408

    public static boolean equals(ByteBuf a, int aStartIndex, ByteBuf b, int bStartIndex, int length) {
        checkNotNull(a, "a");
        checkNotNull(b, "b");
        // All indexes and lengths must be non-negative
        checkPositiveOrZero(aStartIndex, "aStartIndex");
        checkPositiveOrZero(bStartIndex, "bStartIndex");
        checkPositiveOrZero(length, "length");

        if (a.writerIndex() - length < aStartIndex || b.writerIndex() - length < bStartIndex) {
            return false;
        }

        final int longCount = length >>> 3;
        final int byteCount = length & 7;

        if (a.order() == b.order()) {
            for (int i = longCount; i > 0; i --) {
                if (a.getLong(aStartIndex) != b.getLong(bStartIndex)) {
                    return false;
                }
                aStartIndex += 8;
                bStartIndex += 8;
            }
        } else {
            for (int i = longCount; i > 0; i --) {
                if (a.getLong(aStartIndex) != swapLong(b.getLong(bStartIndex))) {
                    return false;
                }
                aStartIndex += 8;
                bStartIndex += 8;
            }
        }

        for (int i = byteCount; i > 0; i --) {
            if (a.getByte(aStartIndex) != b.getByte(bStartIndex)) {
                return false;
            }
            aStartIndex ++;
            bStartIndex ++;
        }

        return true;
    }

Domain

Subdomains

Calls

Frequently Asked Questions

What does equals() do?
equals() is a function in the netty codebase, defined in buffer/src/main/java/io/netty/buffer/ByteBufUtil.java.
Where is equals() defined?
equals() is defined in buffer/src/main/java/io/netty/buffer/ByteBufUtil.java at line 366.
What does equals() call?
equals() calls 1 function(s): swapLong.
What calls equals()?
equals() is called by 3 function(s): String, indexOf, isText.

Analyze Your Own Codebase

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

Try Supermodel Free