143 lines
3.6 KiB
Smali
143 lines
3.6 KiB
Smali
.class public Lorg/apache/http/conn/util/InetAddressUtils;
|
|
.super Ljava/lang/Object;
|
|
.source "InetAddressUtils.java"
|
|
|
|
|
|
# annotations
|
|
.annotation build Lorg/apache/http/annotation/Immutable;
|
|
.end annotation
|
|
|
|
|
|
# static fields
|
|
.field private static final IPV4_PATTERN:Ljava/util/regex/Pattern;
|
|
|
|
.field private static final IPV6_HEX_COMPRESSED_PATTERN:Ljava/util/regex/Pattern;
|
|
|
|
.field private static final IPV6_STD_PATTERN:Ljava/util/regex/Pattern;
|
|
|
|
|
|
# direct methods
|
|
.method public static constructor <clinit>()V
|
|
.locals 1
|
|
|
|
const-string v0, "^(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)(\\.(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)){3}$"
|
|
|
|
.line 1
|
|
invoke-static {v0}, Ljava/util/regex/Pattern;->compile(Ljava/lang/String;)Ljava/util/regex/Pattern;
|
|
|
|
move-result-object v0
|
|
|
|
sput-object v0, Lorg/apache/http/conn/util/InetAddressUtils;->IPV4_PATTERN:Ljava/util/regex/Pattern;
|
|
|
|
const-string v0, "^(?:[0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$"
|
|
|
|
.line 2
|
|
invoke-static {v0}, Ljava/util/regex/Pattern;->compile(Ljava/lang/String;)Ljava/util/regex/Pattern;
|
|
|
|
move-result-object v0
|
|
|
|
sput-object v0, Lorg/apache/http/conn/util/InetAddressUtils;->IPV6_STD_PATTERN:Ljava/util/regex/Pattern;
|
|
|
|
const-string v0, "^((?:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4})*)?)::((?:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4})*)?)$"
|
|
|
|
.line 3
|
|
invoke-static {v0}, Ljava/util/regex/Pattern;->compile(Ljava/lang/String;)Ljava/util/regex/Pattern;
|
|
|
|
move-result-object v0
|
|
|
|
sput-object v0, Lorg/apache/http/conn/util/InetAddressUtils;->IPV6_HEX_COMPRESSED_PATTERN:Ljava/util/regex/Pattern;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method private constructor <init>()V
|
|
.locals 0
|
|
|
|
.line 1
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public static isIPv4Address(Ljava/lang/String;)Z
|
|
.locals 1
|
|
|
|
.line 1
|
|
sget-object v0, Lorg/apache/http/conn/util/InetAddressUtils;->IPV4_PATTERN:Ljava/util/regex/Pattern;
|
|
|
|
invoke-virtual {v0, p0}, Ljava/util/regex/Pattern;->matcher(Ljava/lang/CharSequence;)Ljava/util/regex/Matcher;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-virtual {p0}, Ljava/util/regex/Matcher;->matches()Z
|
|
|
|
move-result p0
|
|
|
|
return p0
|
|
.end method
|
|
|
|
.method public static isIPv6Address(Ljava/lang/String;)Z
|
|
.locals 1
|
|
|
|
.line 1
|
|
invoke-static {p0}, Lorg/apache/http/conn/util/InetAddressUtils;->isIPv6StdAddress(Ljava/lang/String;)Z
|
|
|
|
move-result v0
|
|
|
|
if-nez v0, :cond_1
|
|
|
|
invoke-static {p0}, Lorg/apache/http/conn/util/InetAddressUtils;->isIPv6HexCompressedAddress(Ljava/lang/String;)Z
|
|
|
|
move-result p0
|
|
|
|
if-eqz p0, :cond_0
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
const/4 p0, 0x0
|
|
|
|
goto :goto_1
|
|
|
|
:cond_1
|
|
:goto_0
|
|
const/4 p0, 0x1
|
|
|
|
:goto_1
|
|
return p0
|
|
.end method
|
|
|
|
.method public static isIPv6HexCompressedAddress(Ljava/lang/String;)Z
|
|
.locals 1
|
|
|
|
.line 1
|
|
sget-object v0, Lorg/apache/http/conn/util/InetAddressUtils;->IPV6_HEX_COMPRESSED_PATTERN:Ljava/util/regex/Pattern;
|
|
|
|
invoke-virtual {v0, p0}, Ljava/util/regex/Pattern;->matcher(Ljava/lang/CharSequence;)Ljava/util/regex/Matcher;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-virtual {p0}, Ljava/util/regex/Matcher;->matches()Z
|
|
|
|
move-result p0
|
|
|
|
return p0
|
|
.end method
|
|
|
|
.method public static isIPv6StdAddress(Ljava/lang/String;)Z
|
|
.locals 1
|
|
|
|
.line 1
|
|
sget-object v0, Lorg/apache/http/conn/util/InetAddressUtils;->IPV6_STD_PATTERN:Ljava/util/regex/Pattern;
|
|
|
|
invoke-virtual {v0, p0}, Ljava/util/regex/Pattern;->matcher(Ljava/lang/CharSequence;)Ljava/util/regex/Matcher;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-virtual {p0}, Ljava/util/regex/Matcher;->matches()Z
|
|
|
|
move-result p0
|
|
|
|
return p0
|
|
.end method
|