类 InetAddressValidator


  • public class InetAddressValidator
    extends java.lang.Object
    ipv4 ipv6 check util.
    作者:
    Dynatrace LLC
    • 方法概要

      所有方法 静态方法 具体方法 
      修饰符和类型 方法 说明
      static java.util.regex.Pattern getIpv4Pattern()
      get to ipv4 pattern.
      static boolean isIPv4Address​(java.lang.String input)
      Check if input is a valid IPv4 address.
      static boolean isIPv6Address​(java.lang.String input)
      Check if input is a IPv6 address.
      static boolean isIPv6HexCompressedAddress​(java.lang.String input)
      Check if the given address is a valid IPv6 address in the hex-compressed notation The format is 'xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx'.
      static boolean isIPv6IPv4MappedAddress​(java.lang.String input)
      Check if input is an IPv4 address mapped into a IPv6 address.
      static boolean isIPv6MixedAddress​(java.lang.String input)
      Check if the given address is a valid IPv6 address in the mixed-standard or mixed-compressed notation.
      static boolean isIPv6StdAddress​(java.lang.String input)
      Check if the given address is a valid IPv6 address in the standard format The format is 'xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx'.
      static boolean isLinkLocalIPv6WithZoneIndex​(java.lang.String input)
      Check if input is a link local IPv6 address starting with "fe80:" and containing a zone index with "%xxx".
      static boolean isValidIP​(java.lang.String ipAddress)
      Check if input is a valid IPv4 or IPv6 address.
      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 字段详细资料

      • PERCENT

        private static final java.lang.String PERCENT
        另请参阅:
        常量字段值
      • DOUBLE_COLON

        private static final java.lang.String DOUBLE_COLON
        另请参阅:
        常量字段值
      • DOUBLE_COLON_FFFF

        private static final java.lang.String DOUBLE_COLON_FFFF
        另请参阅:
        常量字段值
      • FE80

        private static final java.lang.String FE80
        另请参阅:
        常量字段值
      • IPV4_PATTERN

        private static final java.util.regex.Pattern IPV4_PATTERN
      • IPV6_STD_PATTERN

        private static final java.util.regex.Pattern IPV6_STD_PATTERN
      • IPV6_HEX_COMPRESSED_PATTERN

        private static final java.util.regex.Pattern IPV6_HEX_COMPRESSED_PATTERN
      • IPV6_MIXED_COMPRESSED_REGEX

        private static final java.util.regex.Pattern IPV6_MIXED_COMPRESSED_REGEX
      • IPV6_MIXED_UNCOMPRESSED_REGEX

        private static final java.util.regex.Pattern IPV6_MIXED_UNCOMPRESSED_REGEX
    • 构造器详细资料

      • InetAddressValidator

        public InetAddressValidator()
    • 方法详细资料

      • isIPv4Address

        public static boolean isIPv4Address​(java.lang.String input)
        Check if input is a valid IPv4 address. The format is 'xxx.xxx.xxx.xxx'. Four blocks of integer numbers ranging from 0 to 255 are required. Letters are not allowed.
        参数:
        input - ip-address to check
        返回:
        true if input is in correct IPv4 notation.
      • isIPv6StdAddress

        public static boolean isIPv6StdAddress​(java.lang.String input)
        Check if the given address is a valid IPv6 address in the standard format The format is 'xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx'. Eight blocks of hexadecimal digits are required.
        参数:
        input - ip-address to check
        返回:
        true if input is in correct IPv6 notation.
      • isIPv6HexCompressedAddress

        public static boolean isIPv6HexCompressedAddress​(java.lang.String input)
        Check if the given address is a valid IPv6 address in the hex-compressed notation The format is 'xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx'. If all digits in a block are '0' the block can be left empty.
        参数:
        input - ip-address to check
        返回:
        true if input is in correct IPv6 (hex-compressed) notation.
      • isIPv6Address

        public static boolean isIPv6Address​(java.lang.String input)
        Check if input is a IPv6 address. Possible notations for valid IPv6 are: - Standard IPv6 address - Hex-compressed IPv6 address - Link-local IPv6 address - IPv4-mapped-to-IPV6 address - IPv6 mixed address
        参数:
        input - ip-address to check
        返回:
        true if input is in correct IPv6 notation.
      • isIPv6MixedAddress

        public static boolean isIPv6MixedAddress​(java.lang.String input)
        Check if the given address is a valid IPv6 address in the mixed-standard or mixed-compressed notation. IPV6 Mixed mode consists of two parts, the first 96 bits (up to 6 blocks of 4 hex digits) are IPv6 the IPV6 part can be either compressed or uncompressed the second block is a full IPv4 address e.g. '0:0:0:0:0:0:172.12.55.18'
        参数:
        input - ip-address to check
        返回:
        true if input is in correct IPv6 (mixed-standard or mixed-compressed) notation.
      • isIPv6IPv4MappedAddress

        public static boolean isIPv6IPv4MappedAddress​(java.lang.String input)
        Check if input is an IPv4 address mapped into a IPv6 address. These are starting with "::ffff:" followed by the IPv4 address in a dot-seperated notation. The format is '::ffff:d.d.d.d'
        参数:
        input - ip-address to check
        返回:
        true if input is in correct IPv6 notation containing an IPv4 address
      • isLinkLocalIPv6WithZoneIndex

        public static boolean isLinkLocalIPv6WithZoneIndex​(java.lang.String input)
        Check if input is a link local IPv6 address starting with "fe80:" and containing a zone index with "%xxx". The zone index will not be checked.
        参数:
        input - ip-address to check
        返回:
        true if address part of input is in correct IPv6 notation.
      • isValidIP

        public static boolean isValidIP​(java.lang.String ipAddress)
        Check if input is a valid IPv4 or IPv6 address.
        参数:
        ipAddress - ip-address to check
        返回:
        true if ipAddress is a valid ip-address
      • getIpv4Pattern

        public static java.util.regex.Pattern getIpv4Pattern()
        get to ipv4 pattern.
        返回: