IPUtil.smali
.class public Lcom/dts/freefireth/FFNetCommand/IPUtil;
.super Ljava/lang/Object;
.source "SourceFile"
# static fields
.field private static final TAG:Ljava/lang/String; = "IPUtil"
# direct methods
.method public constructor <init>()V
.registers 1
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
.method public static isIPv4(Ljava/lang/String;)Z
.registers 2
invoke-static {p0}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
move-result v0
if-eqz v0, :cond_8
const/4 p0, 0x0
return p0
:cond_8
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}$"
invoke-virtual {p0, v0}, Ljava/lang/String;->matches(Ljava/lang/String;)Z
move-result p0
return p0
.end method
.method public static parseIPv4Address(Ljava/lang/String;)Ljava/net/InetAddress;
.registers 3
invoke-static {p0}, Lcom/dts/freefireth/FFNetCommand/IPUtil;->parseIPv4Addresses(Ljava/lang/String;)Ljava/util/List;
move-result-object v0
if-eqz v0, :cond_14
invoke-interface {v0}, Ljava/util/List;->size()I
move-result v1
if-lez v1, :cond_14
const/4 p0, 0x0
invoke-interface {v0, p0}, Ljava/util/List;->get(I)Ljava/lang/Object;
move-result-object p0
check-cast p0, Ljava/net/InetAddress;
return-object p0
:cond_14
new-instance v0, Ljava/net/UnknownHostException;
invoke-direct {v0, p0}, Ljava/net/UnknownHostException;-><init>(Ljava/lang/String;)V
throw v0
.end method
.method public static parseIPv4AddressString(Ljava/lang/String;)Ljava/lang/String;
.registers 2
invoke-static {p0}, Lcom/dts/freefireth/FFNetCommand/IPUtil;->parseIPv4Address(Ljava/lang/String;)Ljava/net/InetAddress;
move-result-object v0
if-eqz v0, :cond_b
invoke-virtual {v0}, Ljava/net/InetAddress;->getHostAddress()Ljava/lang/String;
move-result-object p0
return-object p0
:cond_b
new-instance v0, Ljava/net/UnknownHostException;
invoke-direct {v0, p0}, Ljava/net/UnknownHostException;-><init>(Ljava/lang/String;)V
throw v0
.end method
.method public static parseIPv4Addresses(Ljava/lang/String;)Ljava/util/List;
.registers 6
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Ljava/lang/String;",
")",
"Ljava/util/List<",
"Ljava/net/InetAddress;",
">;"
}
.end annotation
new-instance v0, Ljava/util/ArrayList;
invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V
invoke-static {p0}, Ljava/net/InetAddress;->getAllByName(Ljava/lang/String;)[Ljava/net/InetAddress;
move-result-object p0
array-length v1, p0
const/4 v2, 0x0
:goto_b
if-ge v2, v1, :cond_1f
aget-object v3, p0, v2
invoke-virtual {v3}, Ljava/net/InetAddress;->getHostAddress()Ljava/lang/String;
move-result-object v4
invoke-static {v4}, Lcom/dts/freefireth/FFNetCommand/IPUtil;->isIPv4(Ljava/lang/String;)Z
move-result v4
if-eqz v4, :cond_1c
invoke-interface {v0, v3}, Ljava/util/List;->add(Ljava/lang/Object;)Z
:cond_1c
add-int/lit8 v2, v2, 0x1
goto :goto_b
:cond_1f
return-object v0
.end method