Home / Class/ NetUtil Class — netty Architecture

NetUtil Class — netty Architecture

Architecture documentation for the NetUtil class in NetUtil.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  40fb3f7d_c2dd_316b_f965_bdef8e0dad94["NetUtil"]
  be5c82e6_a4ae_6473_ea92_9debc12b2bf9["NetUtil.java"]
  40fb3f7d_c2dd_316b_f965_bdef8e0dad94 -->|defined in| be5c82e6_a4ae_6473_ea92_9debc12b2bf9
  c2e9d0e2_b1c8_ec6b_17db_f1e9120ac661["Integer()"]
  40fb3f7d_c2dd_316b_f965_bdef8e0dad94 -->|method| c2e9d0e2_b1c8_ec6b_17db_f1e9120ac661
  ed5f91f4_f15c_ff89_8b5b_5cbc6adde880["isIpV4StackPreferred()"]
  40fb3f7d_c2dd_316b_f965_bdef8e0dad94 -->|method| ed5f91f4_f15c_ff89_8b5b_5cbc6adde880
  502df730_6329_d28e_8518_ad4b8e21b059["isIpV6AddressesPreferred()"]
  40fb3f7d_c2dd_316b_f965_bdef8e0dad94 -->|method| 502df730_6329_d28e_8518_ad4b8e21b059
  9dd33ef5_da27_82d2_b43a_42b0859ae8c2["createByteArrayFromIpAddressString()"]
  40fb3f7d_c2dd_316b_f965_bdef8e0dad94 -->|method| 9dd33ef5_da27_82d2_b43a_42b0859ae8c2
  cc85d9b2_7b73_14a5_b35e_ad071f8fc178["InetAddress()"]
  40fb3f7d_c2dd_316b_f965_bdef8e0dad94 -->|method| cc85d9b2_7b73_14a5_b35e_ad071f8fc178
  4c9a35ab_d065_5ca2_2cf8_4b2cbab53185["decimalDigit()"]
  40fb3f7d_c2dd_316b_f965_bdef8e0dad94 -->|method| 4c9a35ab_d065_5ca2_2cf8_4b2cbab53185
  6014483a_62f5_4508_e69f_057f3f95b77e["ipv4WordToByte()"]
  40fb3f7d_c2dd_316b_f965_bdef8e0dad94 -->|method| 6014483a_62f5_4508_e69f_057f3f95b77e
  42de1372_5ffc_33b5_49ba_958b59b48626["validIpV4ToBytes()"]
  40fb3f7d_c2dd_316b_f965_bdef8e0dad94 -->|method| 42de1372_5ffc_33b5_49ba_958b59b48626
  4cf25418_32d5_84a8_9633_159d8dafbab1["ipv4AddressToInt()"]
  40fb3f7d_c2dd_316b_f965_bdef8e0dad94 -->|method| 4cf25418_32d5_84a8_9633_159d8dafbab1
  76ca794c_42a7_ae42_5748_a0485c14cd5a["String()"]
  40fb3f7d_c2dd_316b_f965_bdef8e0dad94 -->|method| 76ca794c_42a7_ae42_5748_a0485c14cd5a
  18d4d9ec_e642_8239_767f_3cf0665429c5["isValidIpV6Address()"]
  40fb3f7d_c2dd_316b_f965_bdef8e0dad94 -->|method| 18d4d9ec_e642_8239_767f_3cf0665429c5
  f668324c_fd5c_4354_3f91_248cdec098d2["isValidIpV4Word()"]
  40fb3f7d_c2dd_316b_f965_bdef8e0dad94 -->|method| f668324c_fd5c_4354_3f91_248cdec098d2
  e2630fbb_38fc_e090_ae00_8810e0f7283b["isValidHexChar()"]
  40fb3f7d_c2dd_316b_f965_bdef8e0dad94 -->|method| e2630fbb_38fc_e090_ae00_8810e0f7283b

Relationship Graph

Source Code

common/src/main/java/io/netty/util/NetUtil.java lines 52–1104

public final class NetUtil {

    /**
     * The {@link Inet4Address} that represents the IPv4 loopback address '127.0.0.1'
     */
    public static final Inet4Address LOCALHOST4;

    /**
     * The {@link Inet6Address} that represents the IPv6 loopback address '::1'
     */
    public static final Inet6Address LOCALHOST6;

    /**
     * The {@link InetAddress} that represents the loopback address. If IPv6 stack is available, it will refer to
     * {@link #LOCALHOST6}.  Otherwise, {@link #LOCALHOST4}.
     */
    public static final InetAddress LOCALHOST;

    /**
     * The loopback {@link NetworkInterface} of the current machine
     */
    public static final NetworkInterface LOOPBACK_IF;

    /**
     * An unmodifiable Collection of all the interfaces on this machine.
     */
    public static final Collection<NetworkInterface> NETWORK_INTERFACES;

    /**
     * The SOMAXCONN value of the current machine.  If failed to get the value,  {@code 200} is used as a
     * default value for Windows and {@code 128} for others.
     */
    public static final int SOMAXCONN;

    /**
     * This defines how many words (represented as ints) are needed to represent an IPv6 address
     */
    private static final int IPV6_WORD_COUNT = 8;

    /**
     * The maximum number of characters for an IPV6 string with no scope
     */
    private static final int IPV6_MAX_CHAR_COUNT = 39;

    /**
     * Number of bytes needed to represent an IPV6 value
     */
    private static final int IPV6_BYTE_COUNT = 16;

    /**
     * Maximum amount of value adding characters in between IPV6 separators
     */
    private static final int IPV6_MAX_CHAR_BETWEEN_SEPARATOR = 4;

    /**
     * Minimum number of separators that must be present in an IPv6 string
     */
    private static final int IPV6_MIN_SEPARATORS = 2;

    /**
     * Maximum number of separators that must be present in an IPv6 string
     */
    private static final int IPV6_MAX_SEPARATORS = 8;

    /**
     * Maximum amount of value adding characters in between IPV4 separators
     */
    private static final int IPV4_MAX_CHAR_BETWEEN_SEPARATOR = 3;

    /**
     * Number of separators that must be present in an IPv4 string
     */
    private static final int IPV4_SEPARATORS = 3;

    /**
     * {@code true} if IPv4 should be used even if the system supports both IPv4 and IPv6.
     */
    private static final boolean IPV4_PREFERRED = SystemPropertyUtil.getBoolean("java.net.preferIPv4Stack", false);

    /**
     * {@code true} if an IPv6 address should be preferred when a host has both an IPv4 address and an IPv6 address.

Frequently Asked Questions

What is the NetUtil class?
NetUtil is a class in the netty codebase, defined in common/src/main/java/io/netty/util/NetUtil.java.
Where is NetUtil defined?
NetUtil is defined in common/src/main/java/io/netty/util/NetUtil.java at line 52.

Analyze Your Own Codebase

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

Try Supermodel Free