420 lines
10 KiB
Smali
420 lines
10 KiB
Smali
.class public final Lokhttp3/MediaType;
|
|
.super Ljava/lang/Object;
|
|
.source "MediaType.java"
|
|
|
|
|
|
# static fields
|
|
.field private static final bul:Ljava/util/regex/Pattern;
|
|
|
|
.field private static final bum:Ljava/util/regex/Pattern;
|
|
|
|
|
|
# instance fields
|
|
.field private final bun:Ljava/lang/String;
|
|
|
|
.field public final buo:Ljava/lang/String;
|
|
|
|
.field private final bup:Ljava/lang/String;
|
|
.annotation runtime Ljavax/annotation/Nullable;
|
|
.end annotation
|
|
.end field
|
|
|
|
.field public final type:Ljava/lang/String;
|
|
|
|
|
|
# direct methods
|
|
.method static constructor <clinit>()V
|
|
.locals 1
|
|
|
|
const-string v0, "([a-zA-Z0-9-!#$%&\'*+.^_`{|}~]+)/([a-zA-Z0-9-!#$%&\'*+.^_`{|}~]+)"
|
|
|
|
invoke-static {v0}, Ljava/util/regex/Pattern;->compile(Ljava/lang/String;)Ljava/util/regex/Pattern;
|
|
|
|
move-result-object v0
|
|
|
|
sput-object v0, Lokhttp3/MediaType;->bul:Ljava/util/regex/Pattern;
|
|
|
|
const-string v0, ";\\s*(?:([a-zA-Z0-9-!#$%&\'*+.^_`{|}~]+)=(?:([a-zA-Z0-9-!#$%&\'*+.^_`{|}~]+)|\"([^\"]*)\"))?"
|
|
|
|
invoke-static {v0}, Ljava/util/regex/Pattern;->compile(Ljava/lang/String;)Ljava/util/regex/Pattern;
|
|
|
|
move-result-object v0
|
|
|
|
sput-object v0, Lokhttp3/MediaType;->bum:Ljava/util/regex/Pattern;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method private constructor <init>(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
|
|
.locals 0
|
|
.param p4 # Ljava/lang/String;
|
|
.annotation runtime Ljavax/annotation/Nullable;
|
|
.end annotation
|
|
.end param
|
|
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
iput-object p1, p0, Lokhttp3/MediaType;->bun:Ljava/lang/String;
|
|
|
|
iput-object p2, p0, Lokhttp3/MediaType;->type:Ljava/lang/String;
|
|
|
|
iput-object p3, p0, Lokhttp3/MediaType;->buo:Ljava/lang/String;
|
|
|
|
iput-object p4, p0, Lokhttp3/MediaType;->bup:Ljava/lang/String;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public static eh(Ljava/lang/String;)Lokhttp3/MediaType;
|
|
.locals 11
|
|
|
|
sget-object v0, Lokhttp3/MediaType;->bul:Ljava/util/regex/Pattern;
|
|
|
|
invoke-virtual {v0, p0}, Ljava/util/regex/Pattern;->matcher(Ljava/lang/CharSequence;)Ljava/util/regex/Matcher;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {v0}, Ljava/util/regex/Matcher;->lookingAt()Z
|
|
|
|
move-result v1
|
|
|
|
const/16 v2, 0x22
|
|
|
|
if-eqz v1, :cond_7
|
|
|
|
const/4 v1, 0x1
|
|
|
|
invoke-virtual {v0, v1}, Ljava/util/regex/Matcher;->group(I)Ljava/lang/String;
|
|
|
|
move-result-object v3
|
|
|
|
sget-object v4, Ljava/util/Locale;->US:Ljava/util/Locale;
|
|
|
|
invoke-virtual {v3, v4}, Ljava/lang/String;->toLowerCase(Ljava/util/Locale;)Ljava/lang/String;
|
|
|
|
move-result-object v3
|
|
|
|
const/4 v4, 0x2
|
|
|
|
invoke-virtual {v0, v4}, Ljava/util/regex/Matcher;->group(I)Ljava/lang/String;
|
|
|
|
move-result-object v5
|
|
|
|
sget-object v6, Ljava/util/Locale;->US:Ljava/util/Locale;
|
|
|
|
invoke-virtual {v5, v6}, Ljava/lang/String;->toLowerCase(Ljava/util/Locale;)Ljava/lang/String;
|
|
|
|
move-result-object v5
|
|
|
|
const/4 v6, 0x0
|
|
|
|
sget-object v7, Lokhttp3/MediaType;->bum:Ljava/util/regex/Pattern;
|
|
|
|
invoke-virtual {v7, p0}, Ljava/util/regex/Pattern;->matcher(Ljava/lang/CharSequence;)Ljava/util/regex/Matcher;
|
|
|
|
move-result-object v7
|
|
|
|
invoke-virtual {v0}, Ljava/util/regex/Matcher;->end()I
|
|
|
|
move-result v0
|
|
|
|
:goto_0
|
|
invoke-virtual {p0}, Ljava/lang/String;->length()I
|
|
|
|
move-result v8
|
|
|
|
if-ge v0, v8, :cond_6
|
|
|
|
invoke-virtual {p0}, Ljava/lang/String;->length()I
|
|
|
|
move-result v8
|
|
|
|
invoke-virtual {v7, v0, v8}, Ljava/util/regex/Matcher;->region(II)Ljava/util/regex/Matcher;
|
|
|
|
invoke-virtual {v7}, Ljava/util/regex/Matcher;->lookingAt()Z
|
|
|
|
move-result v8
|
|
|
|
const-string v9, "\" for: \""
|
|
|
|
if-eqz v8, :cond_5
|
|
|
|
invoke-virtual {v7, v1}, Ljava/util/regex/Matcher;->group(I)Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
if-eqz v0, :cond_4
|
|
|
|
const-string v8, "charset"
|
|
|
|
invoke-virtual {v0, v8}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z
|
|
|
|
move-result v0
|
|
|
|
if-eqz v0, :cond_4
|
|
|
|
invoke-virtual {v7, v4}, Ljava/util/regex/Matcher;->group(I)Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
const-string v8, "\'"
|
|
|
|
invoke-virtual {v0, v8}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z
|
|
|
|
move-result v10
|
|
|
|
if-eqz v10, :cond_1
|
|
|
|
invoke-virtual {v0, v8}, Ljava/lang/String;->endsWith(Ljava/lang/String;)Z
|
|
|
|
move-result v8
|
|
|
|
if-eqz v8, :cond_1
|
|
|
|
invoke-virtual {v0}, Ljava/lang/String;->length()I
|
|
|
|
move-result v8
|
|
|
|
if-le v8, v4, :cond_1
|
|
|
|
invoke-virtual {v0}, Ljava/lang/String;->length()I
|
|
|
|
move-result v8
|
|
|
|
sub-int/2addr v8, v1
|
|
|
|
invoke-virtual {v0, v1, v8}, Ljava/lang/String;->substring(II)Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
goto :goto_1
|
|
|
|
:cond_0
|
|
const/4 v0, 0x3
|
|
|
|
invoke-virtual {v7, v0}, Ljava/util/regex/Matcher;->group(I)Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
:cond_1
|
|
:goto_1
|
|
if-eqz v6, :cond_3
|
|
|
|
invoke-virtual {v0, v6}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z
|
|
|
|
move-result v8
|
|
|
|
if-eqz v8, :cond_2
|
|
|
|
goto :goto_2
|
|
|
|
:cond_2
|
|
new-instance v1, Ljava/lang/IllegalArgumentException;
|
|
|
|
new-instance v3, Ljava/lang/StringBuilder;
|
|
|
|
const-string v4, "Multiple charsets defined: \""
|
|
|
|
invoke-direct {v3, v4}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
|
|
|
|
invoke-virtual {v3, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
const-string v4, "\" and: \""
|
|
|
|
invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v3, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v3, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v3, v2}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-direct {v1, p0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw v1
|
|
|
|
:cond_3
|
|
:goto_2
|
|
move-object v6, v0
|
|
|
|
:cond_4
|
|
invoke-virtual {v7}, Ljava/util/regex/Matcher;->end()I
|
|
|
|
move-result v0
|
|
|
|
goto :goto_0
|
|
|
|
:cond_5
|
|
new-instance v1, Ljava/lang/IllegalArgumentException;
|
|
|
|
new-instance v3, Ljava/lang/StringBuilder;
|
|
|
|
const-string v4, "Parameter is not formatted correctly: \""
|
|
|
|
invoke-direct {v3, v4}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
|
|
|
|
invoke-virtual {p0, v0}, Ljava/lang/String;->substring(I)Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {v3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v3, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v3, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v3, v2}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-direct {v1, p0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw v1
|
|
|
|
:cond_6
|
|
new-instance v0, Lokhttp3/MediaType;
|
|
|
|
invoke-direct {v0, p0, v3, v5, v6}, Lokhttp3/MediaType;-><init>(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
|
|
|
|
return-object v0
|
|
|
|
:cond_7
|
|
new-instance v0, Ljava/lang/IllegalArgumentException;
|
|
|
|
new-instance v1, Ljava/lang/StringBuilder;
|
|
|
|
const-string v3, "No subtype found for: \""
|
|
|
|
invoke-direct {v1, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
|
|
|
|
invoke-virtual {v1, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-direct {v0, p0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
|
|
|
|
goto :goto_4
|
|
|
|
:goto_3
|
|
throw v0
|
|
|
|
:goto_4
|
|
goto :goto_3
|
|
.end method
|
|
|
|
.method public static ei(Ljava/lang/String;)Lokhttp3/MediaType;
|
|
.locals 0
|
|
.annotation runtime Ljavax/annotation/Nullable;
|
|
.end annotation
|
|
|
|
:try_start_0
|
|
invoke-static {p0}, Lokhttp3/MediaType;->eh(Ljava/lang/String;)Lokhttp3/MediaType;
|
|
|
|
move-result-object p0
|
|
:try_end_0
|
|
.catch Ljava/lang/IllegalArgumentException; {:try_start_0 .. :try_end_0} :catch_0
|
|
|
|
return-object p0
|
|
|
|
:catch_0
|
|
const/4 p0, 0x0
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public final b(Ljava/nio/charset/Charset;)Ljava/nio/charset/Charset;
|
|
.locals 1
|
|
.param p1 # Ljava/nio/charset/Charset;
|
|
.annotation runtime Ljavax/annotation/Nullable;
|
|
.end annotation
|
|
.end param
|
|
.annotation runtime Ljavax/annotation/Nullable;
|
|
.end annotation
|
|
|
|
:try_start_0
|
|
iget-object v0, p0, Lokhttp3/MediaType;->bup:Ljava/lang/String;
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
iget-object v0, p0, Lokhttp3/MediaType;->bup:Ljava/lang/String;
|
|
|
|
invoke-static {v0}, Ljava/nio/charset/Charset;->forName(Ljava/lang/String;)Ljava/nio/charset/Charset;
|
|
|
|
move-result-object p1
|
|
:try_end_0
|
|
.catch Ljava/lang/IllegalArgumentException; {:try_start_0 .. :try_end_0} :catch_0
|
|
|
|
:catch_0
|
|
:cond_0
|
|
return-object p1
|
|
.end method
|
|
|
|
.method public final equals(Ljava/lang/Object;)Z
|
|
.locals 1
|
|
.param p1 # Ljava/lang/Object;
|
|
.annotation runtime Ljavax/annotation/Nullable;
|
|
.end annotation
|
|
.end param
|
|
|
|
instance-of v0, p1, Lokhttp3/MediaType;
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
check-cast p1, Lokhttp3/MediaType;
|
|
|
|
iget-object p1, p1, Lokhttp3/MediaType;->bun:Ljava/lang/String;
|
|
|
|
iget-object v0, p0, Lokhttp3/MediaType;->bun:Ljava/lang/String;
|
|
|
|
invoke-virtual {p1, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
|
|
|
|
move-result p1
|
|
|
|
if-eqz p1, :cond_0
|
|
|
|
const/4 p1, 0x1
|
|
|
|
return p1
|
|
|
|
:cond_0
|
|
const/4 p1, 0x0
|
|
|
|
return p1
|
|
.end method
|
|
|
|
.method public final hashCode()I
|
|
.locals 1
|
|
|
|
iget-object v0, p0, Lokhttp3/MediaType;->bun:Ljava/lang/String;
|
|
|
|
invoke-virtual {v0}, Ljava/lang/String;->hashCode()I
|
|
|
|
move-result v0
|
|
|
|
return v0
|
|
.end method
|
|
|
|
.method public final toString()Ljava/lang/String;
|
|
.locals 1
|
|
|
|
iget-object v0, p0, Lokhttp3/MediaType;->bun:Ljava/lang/String;
|
|
|
|
return-object v0
|
|
.end method
|