312 lines
7.1 KiB
Smali
312 lines
7.1 KiB
Smali
.class public final Lokhttp3/internal/http/HttpDate;
|
|
.super Ljava/lang/Object;
|
|
.source "HttpDate.java"
|
|
|
|
|
|
# static fields
|
|
.field private static final BROWSER_COMPATIBLE_DATE_FORMATS:[Ljava/text/DateFormat;
|
|
|
|
.field private static final BROWSER_COMPATIBLE_DATE_FORMAT_STRINGS:[Ljava/lang/String;
|
|
|
|
.field public static final MAX_DATE:J = 0xe677d21fdbffL
|
|
|
|
.field private static final STANDARD_DATE_FORMAT:Ljava/lang/ThreadLocal;
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"Ljava/lang/ThreadLocal",
|
|
"<",
|
|
"Ljava/text/DateFormat;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
.end field
|
|
|
|
|
|
# direct methods
|
|
.method static constructor <clinit>()V
|
|
.locals 3
|
|
|
|
.prologue
|
|
new-instance v0, Lokhttp3/internal/http/HttpDate$1;
|
|
|
|
invoke-direct {v0}, Lokhttp3/internal/http/HttpDate$1;-><init>()V
|
|
|
|
sput-object v0, Lokhttp3/internal/http/HttpDate;->STANDARD_DATE_FORMAT:Ljava/lang/ThreadLocal;
|
|
|
|
const/16 v0, 0xf
|
|
|
|
new-array v0, v0, [Ljava/lang/String;
|
|
|
|
const/4 v1, 0x0
|
|
|
|
const-string v2, "EEE, dd MMM yyyy HH:mm:ss zzz"
|
|
|
|
aput-object v2, v0, v1
|
|
|
|
const/4 v1, 0x1
|
|
|
|
const-string v2, "EEEE, dd-MMM-yy HH:mm:ss zzz"
|
|
|
|
aput-object v2, v0, v1
|
|
|
|
const/4 v1, 0x2
|
|
|
|
const-string v2, "EEE MMM d HH:mm:ss yyyy"
|
|
|
|
aput-object v2, v0, v1
|
|
|
|
const/4 v1, 0x3
|
|
|
|
const-string v2, "EEE, dd-MMM-yyyy HH:mm:ss z"
|
|
|
|
aput-object v2, v0, v1
|
|
|
|
const/4 v1, 0x4
|
|
|
|
const-string v2, "EEE, dd-MMM-yyyy HH-mm-ss z"
|
|
|
|
aput-object v2, v0, v1
|
|
|
|
const/4 v1, 0x5
|
|
|
|
const-string v2, "EEE, dd MMM yy HH:mm:ss z"
|
|
|
|
aput-object v2, v0, v1
|
|
|
|
const/4 v1, 0x6
|
|
|
|
const-string v2, "EEE dd-MMM-yyyy HH:mm:ss z"
|
|
|
|
aput-object v2, v0, v1
|
|
|
|
const/4 v1, 0x7
|
|
|
|
const-string v2, "EEE dd MMM yyyy HH:mm:ss z"
|
|
|
|
aput-object v2, v0, v1
|
|
|
|
const/16 v1, 0x8
|
|
|
|
const-string v2, "EEE dd-MMM-yyyy HH-mm-ss z"
|
|
|
|
aput-object v2, v0, v1
|
|
|
|
const/16 v1, 0x9
|
|
|
|
const-string v2, "EEE dd-MMM-yy HH:mm:ss z"
|
|
|
|
aput-object v2, v0, v1
|
|
|
|
const/16 v1, 0xa
|
|
|
|
const-string v2, "EEE dd MMM yy HH:mm:ss z"
|
|
|
|
aput-object v2, v0, v1
|
|
|
|
const/16 v1, 0xb
|
|
|
|
const-string v2, "EEE,dd-MMM-yy HH:mm:ss z"
|
|
|
|
aput-object v2, v0, v1
|
|
|
|
const/16 v1, 0xc
|
|
|
|
const-string v2, "EEE,dd-MMM-yyyy HH:mm:ss z"
|
|
|
|
aput-object v2, v0, v1
|
|
|
|
const/16 v1, 0xd
|
|
|
|
const-string v2, "EEE, dd-MM-yyyy HH:mm:ss z"
|
|
|
|
aput-object v2, v0, v1
|
|
|
|
const/16 v1, 0xe
|
|
|
|
const-string v2, "EEE MMM d yyyy HH:mm:ss z"
|
|
|
|
aput-object v2, v0, v1
|
|
|
|
sput-object v0, Lokhttp3/internal/http/HttpDate;->BROWSER_COMPATIBLE_DATE_FORMAT_STRINGS:[Ljava/lang/String;
|
|
|
|
sget-object v0, Lokhttp3/internal/http/HttpDate;->BROWSER_COMPATIBLE_DATE_FORMAT_STRINGS:[Ljava/lang/String;
|
|
|
|
array-length v0, v0
|
|
|
|
new-array v0, v0, [Ljava/text/DateFormat;
|
|
|
|
sput-object v0, Lokhttp3/internal/http/HttpDate;->BROWSER_COMPATIBLE_DATE_FORMATS:[Ljava/text/DateFormat;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method private constructor <init>()V
|
|
.locals 0
|
|
|
|
.prologue
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public static format(Ljava/util/Date;)Ljava/lang/String;
|
|
.locals 1
|
|
.param p0, "value" # Ljava/util/Date;
|
|
|
|
.prologue
|
|
sget-object v0, Lokhttp3/internal/http/HttpDate;->STANDARD_DATE_FORMAT:Ljava/lang/ThreadLocal;
|
|
|
|
invoke-virtual {v0}, Ljava/lang/ThreadLocal;->get()Ljava/lang/Object;
|
|
|
|
move-result-object v0
|
|
|
|
check-cast v0, Ljava/text/DateFormat;
|
|
|
|
invoke-virtual {v0, p0}, Ljava/text/DateFormat;->format(Ljava/util/Date;)Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
return-object v0
|
|
.end method
|
|
|
|
.method public static parse(Ljava/lang/String;)Ljava/util/Date;
|
|
.locals 9
|
|
.param p0, "value" # Ljava/lang/String;
|
|
|
|
.prologue
|
|
const/4 v6, 0x0
|
|
|
|
const/4 v7, 0x0
|
|
|
|
invoke-virtual {p0}, Ljava/lang/String;->length()I
|
|
|
|
move-result v5
|
|
|
|
if-nez v5, :cond_1
|
|
|
|
move-object v4, v6
|
|
|
|
:cond_0
|
|
:goto_0
|
|
return-object v4
|
|
|
|
:cond_1
|
|
new-instance v3, Ljava/text/ParsePosition;
|
|
|
|
invoke-direct {v3, v7}, Ljava/text/ParsePosition;-><init>(I)V
|
|
|
|
.local v3, "position":Ljava/text/ParsePosition;
|
|
sget-object v5, Lokhttp3/internal/http/HttpDate;->STANDARD_DATE_FORMAT:Ljava/lang/ThreadLocal;
|
|
|
|
invoke-virtual {v5}, Ljava/lang/ThreadLocal;->get()Ljava/lang/Object;
|
|
|
|
move-result-object v5
|
|
|
|
check-cast v5, Ljava/text/DateFormat;
|
|
|
|
invoke-virtual {v5, p0, v3}, Ljava/text/DateFormat;->parse(Ljava/lang/String;Ljava/text/ParsePosition;)Ljava/util/Date;
|
|
|
|
move-result-object v4
|
|
|
|
.local v4, "result":Ljava/util/Date;
|
|
invoke-virtual {v3}, Ljava/text/ParsePosition;->getIndex()I
|
|
|
|
move-result v5
|
|
|
|
invoke-virtual {p0}, Ljava/lang/String;->length()I
|
|
|
|
move-result v7
|
|
|
|
if-eq v5, v7, :cond_0
|
|
|
|
sget-object v7, Lokhttp3/internal/http/HttpDate;->BROWSER_COMPATIBLE_DATE_FORMAT_STRINGS:[Ljava/lang/String;
|
|
|
|
monitor-enter v7
|
|
|
|
const/4 v2, 0x0
|
|
|
|
.local v2, "i":I
|
|
:try_start_0
|
|
sget-object v5, Lokhttp3/internal/http/HttpDate;->BROWSER_COMPATIBLE_DATE_FORMAT_STRINGS:[Ljava/lang/String;
|
|
|
|
array-length v0, v5
|
|
|
|
.local v0, "count":I
|
|
:goto_1
|
|
if-ge v2, v0, :cond_4
|
|
|
|
sget-object v5, Lokhttp3/internal/http/HttpDate;->BROWSER_COMPATIBLE_DATE_FORMATS:[Ljava/text/DateFormat;
|
|
|
|
aget-object v1, v5, v2
|
|
|
|
.local v1, "format":Ljava/text/DateFormat;
|
|
if-nez v1, :cond_2
|
|
|
|
new-instance v1, Ljava/text/SimpleDateFormat;
|
|
|
|
.end local v1 # "format":Ljava/text/DateFormat;
|
|
sget-object v5, Lokhttp3/internal/http/HttpDate;->BROWSER_COMPATIBLE_DATE_FORMAT_STRINGS:[Ljava/lang/String;
|
|
|
|
aget-object v5, v5, v2
|
|
|
|
sget-object v8, Ljava/util/Locale;->US:Ljava/util/Locale;
|
|
|
|
invoke-direct {v1, v5, v8}, Ljava/text/SimpleDateFormat;-><init>(Ljava/lang/String;Ljava/util/Locale;)V
|
|
|
|
.restart local v1 # "format":Ljava/text/DateFormat;
|
|
sget-object v5, Lokhttp3/internal/Util;->UTC:Ljava/util/TimeZone;
|
|
|
|
invoke-virtual {v1, v5}, Ljava/text/DateFormat;->setTimeZone(Ljava/util/TimeZone;)V
|
|
|
|
sget-object v5, Lokhttp3/internal/http/HttpDate;->BROWSER_COMPATIBLE_DATE_FORMATS:[Ljava/text/DateFormat;
|
|
|
|
aput-object v1, v5, v2
|
|
|
|
:cond_2
|
|
const/4 v5, 0x0
|
|
|
|
invoke-virtual {v3, v5}, Ljava/text/ParsePosition;->setIndex(I)V
|
|
|
|
invoke-virtual {v1, p0, v3}, Ljava/text/DateFormat;->parse(Ljava/lang/String;Ljava/text/ParsePosition;)Ljava/util/Date;
|
|
|
|
move-result-object v4
|
|
|
|
invoke-virtual {v3}, Ljava/text/ParsePosition;->getIndex()I
|
|
|
|
move-result v5
|
|
|
|
if-eqz v5, :cond_3
|
|
|
|
monitor-exit v7
|
|
|
|
goto :goto_0
|
|
|
|
.end local v0 # "count":I
|
|
.end local v1 # "format":Ljava/text/DateFormat;
|
|
:catchall_0
|
|
move-exception v5
|
|
|
|
monitor-exit v7
|
|
:try_end_0
|
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
|
|
|
throw v5
|
|
|
|
.restart local v0 # "count":I
|
|
.restart local v1 # "format":Ljava/text/DateFormat;
|
|
:cond_3
|
|
add-int/lit8 v2, v2, 0x1
|
|
|
|
goto :goto_1
|
|
|
|
.end local v1 # "format":Ljava/text/DateFormat;
|
|
:cond_4
|
|
:try_start_1
|
|
monitor-exit v7
|
|
:try_end_1
|
|
.catchall {:try_start_1 .. :try_end_1} :catchall_0
|
|
|
|
move-object v4, v6
|
|
|
|
goto :goto_0
|
|
.end method
|