mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2024-12-27 09:32:27 -06:00
348 lines
8.2 KiB
Smali
348 lines
8.2 KiB
Smali
.class public final Landroidx/media3/datasource/HttpUtil;
|
|
.super Ljava/lang/Object;
|
|
.source "HttpUtil.java"
|
|
|
|
|
|
# static fields
|
|
.field private static final CONTENT_RANGE_WITH_SIZE:Ljava/util/regex/Pattern;
|
|
|
|
.field private static final CONTENT_RANGE_WITH_START_AND_END:Ljava/util/regex/Pattern;
|
|
|
|
.field private static final TAG:Ljava/lang/String; = "HttpUtil"
|
|
|
|
|
|
# direct methods
|
|
.method static constructor <clinit>()V
|
|
.locals 1
|
|
|
|
const-string v0, "bytes (\\d+)-(\\d+)/(?:\\d+|\\*)"
|
|
|
|
.line 36
|
|
invoke-static {v0}, Ljava/util/regex/Pattern;->compile(Ljava/lang/String;)Ljava/util/regex/Pattern;
|
|
|
|
move-result-object v0
|
|
|
|
sput-object v0, Landroidx/media3/datasource/HttpUtil;->CONTENT_RANGE_WITH_START_AND_END:Ljava/util/regex/Pattern;
|
|
|
|
const-string v0, "bytes (?:(?:\\d+-\\d+)|\\*)/(\\d+)"
|
|
|
|
.line 38
|
|
invoke-static {v0}, Ljava/util/regex/Pattern;->compile(Ljava/lang/String;)Ljava/util/regex/Pattern;
|
|
|
|
move-result-object v0
|
|
|
|
sput-object v0, Landroidx/media3/datasource/HttpUtil;->CONTENT_RANGE_WITH_SIZE:Ljava/util/regex/Pattern;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method private constructor <init>()V
|
|
.locals 0
|
|
|
|
.line 41
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public static buildRangeRequestHeader(JJ)Ljava/lang/String;
|
|
.locals 4
|
|
|
|
const-wide/16 v0, 0x0
|
|
|
|
cmp-long v0, p0, v0
|
|
|
|
const-wide/16 v1, -0x1
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
cmp-long v0, p2, v1
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
const/4 p0, 0x0
|
|
|
|
return-object p0
|
|
|
|
.line 56
|
|
:cond_0
|
|
new-instance v0, Ljava/lang/StringBuilder;
|
|
|
|
const-string v3, "bytes="
|
|
|
|
invoke-direct {v0, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
|
|
|
|
.line 58
|
|
invoke-virtual {v0, p0, p1}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;
|
|
|
|
const-string v3, "-"
|
|
|
|
.line 59
|
|
invoke-virtual {v0, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
cmp-long v1, p2, v1
|
|
|
|
if-eqz v1, :cond_1
|
|
|
|
add-long/2addr p0, p2
|
|
|
|
const-wide/16 p2, 0x1
|
|
|
|
sub-long/2addr p0, p2
|
|
|
|
.line 61
|
|
invoke-virtual {v0, p0, p1}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;
|
|
|
|
.line 63
|
|
:cond_1
|
|
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public static getContentLength(Ljava/lang/String;Ljava/lang/String;)J
|
|
.locals 10
|
|
|
|
const-string v0, "Inconsistent headers ["
|
|
|
|
.line 95
|
|
invoke-static {p0}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
|
|
|
|
move-result v1
|
|
|
|
const-string v2, "]"
|
|
|
|
const-string v3, "HttpUtil"
|
|
|
|
if-nez v1, :cond_0
|
|
|
|
.line 97
|
|
:try_start_0
|
|
invoke-static {p0}, Ljava/lang/Long;->parseLong(Ljava/lang/String;)J
|
|
|
|
move-result-wide v4
|
|
:try_end_0
|
|
.catch Ljava/lang/NumberFormatException; {:try_start_0 .. :try_end_0} :catch_0
|
|
|
|
goto :goto_0
|
|
|
|
.line 99
|
|
:catch_0
|
|
new-instance v1, Ljava/lang/StringBuilder;
|
|
|
|
const-string v4, "Unexpected Content-Length ["
|
|
|
|
invoke-direct {v1, v4}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
|
|
|
|
invoke-virtual {v1, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-static {v3, v1}, Landroidx/media3/common/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)V
|
|
|
|
:cond_0
|
|
const-wide/16 v4, -0x1
|
|
|
|
.line 102
|
|
:goto_0
|
|
invoke-static {p1}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
|
|
|
|
move-result v1
|
|
|
|
if-nez v1, :cond_2
|
|
|
|
sget-object v1, Landroidx/media3/datasource/HttpUtil;->CONTENT_RANGE_WITH_START_AND_END:Ljava/util/regex/Pattern;
|
|
|
|
.line 103
|
|
invoke-virtual {v1, p1}, Ljava/util/regex/Pattern;->matcher(Ljava/lang/CharSequence;)Ljava/util/regex/Matcher;
|
|
|
|
move-result-object v1
|
|
|
|
.line 104
|
|
invoke-virtual {v1}, Ljava/util/regex/Matcher;->matches()Z
|
|
|
|
move-result v6
|
|
|
|
if-eqz v6, :cond_2
|
|
|
|
const/4 v6, 0x2
|
|
|
|
.line 107
|
|
:try_start_1
|
|
invoke-virtual {v1, v6}, Ljava/util/regex/Matcher;->group(I)Ljava/lang/String;
|
|
|
|
move-result-object v6
|
|
|
|
invoke-static {v6}, Landroidx/media3/common/util/Assertions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
move-result-object v6
|
|
|
|
check-cast v6, Ljava/lang/String;
|
|
|
|
invoke-static {v6}, Ljava/lang/Long;->parseLong(Ljava/lang/String;)J
|
|
|
|
move-result-wide v6
|
|
|
|
const/4 v8, 0x1
|
|
|
|
.line 108
|
|
invoke-virtual {v1, v8}, Ljava/util/regex/Matcher;->group(I)Ljava/lang/String;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-static {v1}, Landroidx/media3/common/util/Assertions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
move-result-object v1
|
|
|
|
check-cast v1, Ljava/lang/String;
|
|
|
|
invoke-static {v1}, Ljava/lang/Long;->parseLong(Ljava/lang/String;)J
|
|
|
|
move-result-wide v8
|
|
|
|
sub-long/2addr v6, v8
|
|
|
|
const-wide/16 v8, 0x1
|
|
|
|
add-long/2addr v6, v8
|
|
|
|
const-wide/16 v8, 0x0
|
|
|
|
cmp-long v1, v4, v8
|
|
|
|
if-gez v1, :cond_1
|
|
|
|
move-wide v4, v6
|
|
|
|
goto :goto_1
|
|
|
|
:cond_1
|
|
cmp-long v1, v4, v6
|
|
|
|
if-eqz v1, :cond_2
|
|
|
|
.line 119
|
|
new-instance v1, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {v1, v0}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
|
|
|
|
invoke-virtual {v1, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object p0
|
|
|
|
const-string v0, "] ["
|
|
|
|
invoke-virtual {p0, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-virtual {p0, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-virtual {p0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-virtual {p0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-static {v3, p0}, Landroidx/media3/common/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)V
|
|
|
|
.line 122
|
|
invoke-static {v4, v5, v6, v7}, Ljava/lang/Math;->max(JJ)J
|
|
|
|
move-result-wide p0
|
|
:try_end_1
|
|
.catch Ljava/lang/NumberFormatException; {:try_start_1 .. :try_end_1} :catch_1
|
|
|
|
move-wide v4, p0
|
|
|
|
goto :goto_1
|
|
|
|
.line 125
|
|
:catch_1
|
|
new-instance p0, Ljava/lang/StringBuilder;
|
|
|
|
const-string v0, "Unexpected Content-Range ["
|
|
|
|
invoke-direct {p0, v0}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
|
|
|
|
invoke-virtual {p0, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-virtual {p0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-virtual {p0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-static {v3, p0}, Landroidx/media3/common/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)V
|
|
|
|
:cond_2
|
|
:goto_1
|
|
return-wide v4
|
|
.end method
|
|
|
|
.method public static getDocumentSize(Ljava/lang/String;)J
|
|
.locals 3
|
|
|
|
.line 75
|
|
invoke-static {p0}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
|
|
|
|
move-result v0
|
|
|
|
const-wide/16 v1, -0x1
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
return-wide v1
|
|
|
|
:cond_0
|
|
sget-object v0, Landroidx/media3/datasource/HttpUtil;->CONTENT_RANGE_WITH_SIZE:Ljava/util/regex/Pattern;
|
|
|
|
.line 78
|
|
invoke-virtual {v0, p0}, Ljava/util/regex/Pattern;->matcher(Ljava/lang/CharSequence;)Ljava/util/regex/Matcher;
|
|
|
|
move-result-object p0
|
|
|
|
.line 79
|
|
invoke-virtual {p0}, Ljava/util/regex/Matcher;->matches()Z
|
|
|
|
move-result v0
|
|
|
|
if-eqz v0, :cond_1
|
|
|
|
const/4 v0, 0x1
|
|
|
|
invoke-virtual {p0, v0}, Ljava/util/regex/Matcher;->group(I)Ljava/lang/String;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-static {p0}, Landroidx/media3/common/util/Assertions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
move-result-object p0
|
|
|
|
check-cast p0, Ljava/lang/String;
|
|
|
|
invoke-static {p0}, Ljava/lang/Long;->parseLong(Ljava/lang/String;)J
|
|
|
|
move-result-wide v1
|
|
|
|
:cond_1
|
|
return-wide v1
|
|
.end method
|