Home / Function/ parseMAC() — netty Function Reference

parseMAC() — netty Function Reference

Architecture documentation for the parseMAC() function in MacAddressUtil.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  305a02f9_0c0f_c367_f9d6_4e47f4b9319e["parseMAC()"]
  a4685b43_b51c_914d_456a_1efa65aff7a6["MacAddressUtil"]
  305a02f9_0c0f_c367_f9d6_4e47f4b9319e -->|defined in| a4685b43_b51c_914d_456a_1efa65aff7a6
  5362bac4_444d_c013_8aa9_3e9edb8ab4ee["validateMacSeparator()"]
  305a02f9_0c0f_c367_f9d6_4e47f4b9319e -->|calls| 5362bac4_444d_c013_8aa9_3e9edb8ab4ee
  style 305a02f9_0c0f_c367_f9d6_4e47f4b9319e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

common/src/main/java/io/netty/util/internal/MacAddressUtil.java lines 146–178

    public static byte[] parseMAC(String value) {
        final byte[] machineId;
        final char separator;
        switch (value.length()) {
            case 17:
                separator = value.charAt(2);
                validateMacSeparator(separator);
                machineId = new byte[EUI48_MAC_ADDRESS_LENGTH];
                break;
            case 23:
                separator = value.charAt(2);
                validateMacSeparator(separator);
                machineId = new byte[EUI64_MAC_ADDRESS_LENGTH];
                break;
            default:
                throw new IllegalArgumentException("value is not supported [MAC-48, EUI-48, EUI-64]");
        }

        final int end = machineId.length - 1;
        int j = 0;
        for (int i = 0; i < end; ++i, j += 3) {
            final int sIndex = j + 2;
            machineId[i] = StringUtil.decodeHexByte(value, j);
            if (value.charAt(sIndex) != separator) {
                throw new IllegalArgumentException("expected separator '" + separator + " but got '" +
                        value.charAt(sIndex) + "' at index: " + sIndex);
            }
        }

        machineId[end] = StringUtil.decodeHexByte(value, j);

        return machineId;
    }

Domain

Subdomains

Frequently Asked Questions

What does parseMAC() do?
parseMAC() is a function in the netty codebase, defined in common/src/main/java/io/netty/util/internal/MacAddressUtil.java.
Where is parseMAC() defined?
parseMAC() is defined in common/src/main/java/io/netty/util/internal/MacAddressUtil.java at line 146.
What does parseMAC() call?
parseMAC() calls 1 function(s): validateMacSeparator.

Analyze Your Own Codebase

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

Try Supermodel Free