h.smali

.class public Lcom/fulishe/fs/newvideo/cache/h;
.super Lcom/fulishe/fs/newvideo/cache/p;
.source ""


# instance fields
.field public final a:Lcom/fulishe/fs/newvideo/cache/j;

.field public final b:Lcom/fulishe/fs/newvideo/cache/a/b;

.field public c:Lcom/fulishe/fs/newvideo/cache/d;


# direct methods
.method public constructor <init>(Lcom/fulishe/fs/newvideo/cache/j;Lcom/fulishe/fs/newvideo/cache/a/b;)V
    .registers 3

    invoke-direct {p0, p1, p2}, Lcom/fulishe/fs/newvideo/cache/p;-><init>(Lcom/fulishe/fs/newvideo/cache/s;Lcom/fulishe/fs/newvideo/cache/c;)V

    iput-object p2, p0, Lcom/fulishe/fs/newvideo/cache/h;->b:Lcom/fulishe/fs/newvideo/cache/a/b;

    iput-object p1, p0, Lcom/fulishe/fs/newvideo/cache/h;->a:Lcom/fulishe/fs/newvideo/cache/j;

    return-void
.end method

.method private varargs a(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
    .registers 4

    sget-object v0, Ljava/util/Locale;->US:Ljava/util/Locale;

    invoke-static {v0, p1, p2}, Ljava/lang/String;->format(Ljava/util/Locale;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method private a(Ljava/io/OutputStream;J)V
    .registers 12

    const/4 v1, 0x0

    const/4 v6, -0x1

    const/16 v0, 0x2000

    new-array v2, v0, [B

    iget-object v3, p0, Lcom/fulishe/fs/newvideo/cache/h;->a:Lcom/fulishe/fs/newvideo/cache/j;

    iget-boolean v3, v3, Lcom/fulishe/fs/newvideo/cache/j;->b:Z

    if-eqz v3, :cond_18

    invoke-virtual {p1}, Ljava/io/OutputStream;->flush()V

    :goto_f
    invoke-virtual {p0, v2, p2, p3, v0}, Lcom/fulishe/fs/newvideo/cache/p;->a([BJI)I

    move-result v1

    if-eq v1, v6, :cond_63

    int-to-long v4, v1

    add-long/2addr p2, v4

    goto :goto_f

    :cond_18
    :goto_18
    :try_start_18
    invoke-virtual {p0, v2, p2, p3, v0}, Lcom/fulishe/fs/newvideo/cache/p;->a([BJI)I

    move-result v3

    if-eq v3, v6, :cond_60

    const/4 v4, 0x0

    invoke-virtual {p1, v2, v4, v3}, Ljava/io/OutputStream;->write([BII)V
    :try_end_22
    .catch Ljava/lang/Exception; {:try_start_18 .. :try_end_22} :catch_25
    .catchall {:try_start_18 .. :try_end_22} :catchall_66

    int-to-long v4, v3

    add-long/2addr p2, v4

    goto :goto_18

    :catch_25
    move-exception v0

    :try_start_26
    const-string v2, "HttpProxyCache"

    const-string v3, "e:"

    invoke-static {v2, v3, v0}, Lcom/fulishe/shadow/base/p;->b(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V
    :try_end_2d
    .catch Ljava/lang/Exception; {:try_start_26 .. :try_end_2d} :catch_6b
    .catchall {:try_start_26 .. :try_end_2d} :catchall_66

    const-string v2, "HttpProxyCache"

    :try_start_2f
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    const-string v3, "\u51fa\u9519\u5566\u3002\u3002\u3002\u3002\u3002\u53ef\u80fd\u8fdb\u884c\u91cd\u8bd5\u64ad\u653e\u3002\u3002\u3002\u3002"

    invoke-virtual {v0, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    iget-object v0, p0, Lcom/fulishe/fs/newvideo/cache/p;->i:Lcom/fulishe/fs/newvideo/cache/r;

    if-eqz v0, :cond_64

    const/4 v0, 0x1

    :goto_3f
    invoke-virtual {v3, v0}, Ljava/lang/StringBuilder;->append(Z)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-static {v2, v0}, Lcom/fulishe/shadow/base/p;->a(Ljava/lang/String;Ljava/lang/String;)V

    iget-object v0, p0, Lcom/fulishe/fs/newvideo/cache/p;->i:Lcom/fulishe/fs/newvideo/cache/r;

    if-eqz v0, :cond_60

    const-string v0, "HttpProxyCache"

    const-string v1, "retryPlayerListener===\u88ab\u8c03\u7528\u3002\u3002\u3002\u3002\u3002"

    invoke-static {v0, v1}, Lcom/fulishe/shadow/base/p;->a(Ljava/lang/String;Ljava/lang/String;)V

    iget-object v0, p0, Lcom/fulishe/fs/newvideo/cache/p;->i:Lcom/fulishe/fs/newvideo/cache/r;

    iget-object v1, p0, Lcom/fulishe/fs/newvideo/cache/h;->a:Lcom/fulishe/fs/newvideo/cache/j;

    invoke-virtual {v1}, Lcom/fulishe/fs/newvideo/cache/j;->f()Ljava/lang/String;

    move-result-object v1

    invoke-interface {v0, v1}, Lcom/fulishe/fs/newvideo/cache/r;->a(Ljava/lang/String;)V
    :try_end_60
    .catch Ljava/lang/Exception; {:try_start_2f .. :try_end_60} :catch_6b
    .catchall {:try_start_2f .. :try_end_60} :catchall_66

    :cond_60
    :goto_60
    invoke-virtual {p1}, Ljava/io/OutputStream;->flush()V

    :cond_63
    return-void

    :cond_64
    move v0, v1

    goto :goto_3f

    :catchall_66
    move-exception v0

    invoke-virtual {p1}, Ljava/io/OutputStream;->flush()V

    throw v0

    :catch_6b
    move-exception v0

    goto :goto_60
.end method

.method private a(Lcom/fulishe/fs/newvideo/cache/g;)Z
    .registers 12

    const/4 v1, 0x1

    const/4 v2, 0x0

    iget-object v0, p0, Lcom/fulishe/fs/newvideo/cache/h;->a:Lcom/fulishe/fs/newvideo/cache/j;

    invoke-virtual {v0}, Lcom/fulishe/fs/newvideo/cache/j;->a()J

    move-result-wide v4

    const-wide/16 v6, 0x0

    cmp-long v0, v4, v6

    if-lez v0, :cond_2b

    move v0, v1

    :goto_f
    iget-object v3, p0, Lcom/fulishe/fs/newvideo/cache/h;->b:Lcom/fulishe/fs/newvideo/cache/a/b;

    invoke-virtual {v3}, Lcom/fulishe/fs/newvideo/cache/a/b;->a()J

    move-result-wide v6

    if-eqz v0, :cond_29

    iget-boolean v0, p1, Lcom/fulishe/fs/newvideo/cache/g;->e:Z

    if-eqz v0, :cond_29

    iget-wide v8, p1, Lcom/fulishe/fs/newvideo/cache/g;->d:J

    long-to-float v0, v8

    long-to-float v3, v6

    long-to-float v4, v4

    const v5, 0x3e4ccccd    # 0.2f

    mul-float/2addr v4, v5

    add-float/2addr v3, v4

    cmpg-float v0, v0, v3

    if-gtz v0, :cond_2a

    :cond_29
    move v2, v1

    :cond_2a
    return v2

    :cond_2b
    move v0, v2

    goto :goto_f
.end method

.method private b(Lcom/fulishe/fs/newvideo/cache/g;)Ljava/lang/String;
    .registers 14

    const/4 v1, 0x1

    const/4 v2, 0x0

    iget-object v0, p0, Lcom/fulishe/fs/newvideo/cache/h;->a:Lcom/fulishe/fs/newvideo/cache/j;

    invoke-virtual {v0}, Lcom/fulishe/fs/newvideo/cache/j;->e()Ljava/lang/String;

    move-result-object v10

    invoke-static {v10}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v0

    xor-int/lit8 v11, v0, 0x1

    iget-object v0, p0, Lcom/fulishe/fs/newvideo/cache/h;->b:Lcom/fulishe/fs/newvideo/cache/a/b;

    invoke-virtual {v0}, Lcom/fulishe/fs/newvideo/cache/a/b;->d()Z

    move-result v0

    if-eqz v0, :cond_9f

    iget-object v0, p0, Lcom/fulishe/fs/newvideo/cache/h;->b:Lcom/fulishe/fs/newvideo/cache/a/b;

    invoke-virtual {v0}, Lcom/fulishe/fs/newvideo/cache/a/b;->a()J

    move-result-wide v8

    :goto_1c
    const-wide/16 v4, 0x0

    cmp-long v0, v8, v4

    if-lez v0, :cond_a7

    move v0, v1

    :goto_23
    iget-boolean v3, p1, Lcom/fulishe/fs/newvideo/cache/g;->e:Z

    if-eqz v3, :cond_aa

    iget-wide v4, p1, Lcom/fulishe/fs/newvideo/cache/g;->d:J

    sub-long v4, v8, v4

    move-wide v6, v4

    :goto_2c
    if-eqz v0, :cond_ac

    iget-boolean v3, p1, Lcom/fulishe/fs/newvideo/cache/g;->e:Z

    if-eqz v3, :cond_ac

    move v3, v1

    :goto_33
    new-instance v5, Ljava/lang/StringBuilder;

    invoke-direct {v5}, Ljava/lang/StringBuilder;-><init>()V

    iget-boolean v4, p1, Lcom/fulishe/fs/newvideo/cache/g;->e:Z

    if-eqz v4, :cond_ae

    const-string v4, "HTTP/1.1 206 PARTIAL CONTENT\n"

    :goto_3e
    invoke-virtual {v5, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    const-string v5, "Accept-Ranges: bytes\n"

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    if-eqz v0, :cond_b1

    new-array v0, v1, [Ljava/lang/Object;

    invoke-static {v6, v7}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object v5

    aput-object v5, v0, v2

    const-string v5, "Content-Length: %d\n"

    invoke-direct {p0, v5, v0}, Lcom/fulishe/fs/newvideo/cache/h;->a(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v0

    :goto_58
    invoke-virtual {v4, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    if-eqz v3, :cond_b4

    const/4 v0, 0x3

    new-array v0, v0, [Ljava/lang/Object;

    iget-wide v6, p1, Lcom/fulishe/fs/newvideo/cache/g;->d:J

    invoke-static {v6, v7}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object v3

    aput-object v3, v0, v2

    const-wide/16 v6, 0x1

    sub-long v6, v8, v6

    invoke-static {v6, v7}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object v3

    aput-object v3, v0, v1

    invoke-static {v8, v9}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object v3

    const/4 v5, 0x2

    aput-object v3, v0, v5

    const-string v3, "Content-Range: bytes %d-%d/%d\n"

    invoke-direct {p0, v3, v0}, Lcom/fulishe/fs/newvideo/cache/h;->a(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v0

    :goto_80
    invoke-virtual {v4, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    if-eqz v11, :cond_b7

    new-array v0, v1, [Ljava/lang/Object;

    aput-object v10, v0, v2

    const-string v1, "Content-Type: %s\n"

    invoke-direct {p0, v1, v0}, Lcom/fulishe/fs/newvideo/cache/h;->a(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v0

    :goto_90
    invoke-virtual {v3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    const-string v1, "\n"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    return-object v0

    :cond_9f
    iget-object v0, p0, Lcom/fulishe/fs/newvideo/cache/h;->a:Lcom/fulishe/fs/newvideo/cache/j;

    invoke-virtual {v0}, Lcom/fulishe/fs/newvideo/cache/j;->a()J

    move-result-wide v8

    goto/16 :goto_1c

    :cond_a7
    move v0, v2

    goto/16 :goto_23

    :cond_aa
    move-wide v6, v8

    goto :goto_2c

    :cond_ac
    move v3, v2

    goto :goto_33

    :cond_ae
    const-string v4, "HTTP/1.1 200 OK\n"

    goto :goto_3e

    :cond_b1
    const-string v0, ""

    goto :goto_58

    :cond_b4
    const-string v0, ""

    goto :goto_80

    :cond_b7
    const-string v0, ""

    goto :goto_90
.end method

.method private b(Ljava/io/OutputStream;J)V
    .registers 8

    new-instance v1, Lcom/fulishe/fs/newvideo/cache/j;

    iget-object v0, p0, Lcom/fulishe/fs/newvideo/cache/h;->a:Lcom/fulishe/fs/newvideo/cache/j;

    invoke-direct {v1, v0}, Lcom/fulishe/fs/newvideo/cache/j;-><init>(Lcom/fulishe/fs/newvideo/cache/j;)V

    :try_start_7
    invoke-virtual {v1, p2, p3}, Lcom/fulishe/fs/newvideo/cache/j;->a(J)V

    const/16 v0, 0x2000

    new-array v0, v0, [B

    :goto_e
    invoke-virtual {v1, v0}, Lcom/fulishe/fs/newvideo/cache/j;->a([B)I

    move-result v2

    const/4 v3, -0x1

    if-eq v2, v3, :cond_1f

    const/4 v3, 0x0

    invoke-virtual {p1, v0, v3, v2}, Ljava/io/OutputStream;->write([BII)V
    :try_end_19
    .catchall {:try_start_7 .. :try_end_19} :catchall_1a

    goto :goto_e

    :catchall_1a
    move-exception v0

    invoke-virtual {v1}, Lcom/fulishe/fs/newvideo/cache/j;->b()V

    throw v0

    :cond_1f
    :try_start_1f
    invoke-virtual {p1}, Ljava/io/OutputStream;->flush()V
    :try_end_22
    .catchall {:try_start_1f .. :try_end_22} :catchall_1a

    invoke-virtual {v1}, Lcom/fulishe/fs/newvideo/cache/j;->b()V

    return-void
.end method


# virtual methods
.method public a(I)V
    .registers 5

    iget-object v0, p0, Lcom/fulishe/fs/newvideo/cache/h;->c:Lcom/fulishe/fs/newvideo/cache/d;

    if-eqz v0, :cond_11

    iget-object v1, p0, Lcom/fulishe/fs/newvideo/cache/h;->b:Lcom/fulishe/fs/newvideo/cache/a/b;

    iget-object v1, v1, Lcom/fulishe/fs/newvideo/cache/a/b;->b:Ljava/io/File;

    iget-object v2, p0, Lcom/fulishe/fs/newvideo/cache/h;->a:Lcom/fulishe/fs/newvideo/cache/j;

    invoke-virtual {v2}, Lcom/fulishe/fs/newvideo/cache/j;->f()Ljava/lang/String;

    move-result-object v2

    invoke-interface {v0, v1, v2, p1}, Lcom/fulishe/fs/newvideo/cache/d;->a(Ljava/io/File;Ljava/lang/String;I)V

    :cond_11
    return-void
.end method

.method public a(Lcom/fulishe/fs/newvideo/cache/d;)V
    .registers 2

    iput-object p1, p0, Lcom/fulishe/fs/newvideo/cache/h;->c:Lcom/fulishe/fs/newvideo/cache/d;

    return-void
.end method

.method public a(Lcom/fulishe/fs/newvideo/cache/g;Ljava/net/Socket;)V
    .registers 8

    new-instance v0, Ljava/io/BufferedOutputStream;

    invoke-virtual {p2}, Ljava/net/Socket;->getOutputStream()Ljava/io/OutputStream;

    move-result-object v1

    invoke-direct {v0, v1}, Ljava/io/BufferedOutputStream;-><init>(Ljava/io/OutputStream;)V

    invoke-direct {p0, p1}, Lcom/fulishe/fs/newvideo/cache/h;->b(Lcom/fulishe/fs/newvideo/cache/g;)Ljava/lang/String;

    move-result-object v1

    const-string v2, "UTF-8"

    invoke-virtual {v1, v2}, Ljava/lang/String;->getBytes(Ljava/lang/String;)[B

    move-result-object v1

    invoke-virtual {v0, v1}, Ljava/io/OutputStream;->write([B)V

    iget-wide v2, p1, Lcom/fulishe/fs/newvideo/cache/g;->d:J

    iget-object v1, p0, Lcom/fulishe/fs/newvideo/cache/h;->a:Lcom/fulishe/fs/newvideo/cache/j;

    iget v4, p1, Lcom/fulishe/fs/newvideo/cache/g;->f:I

    iput v4, v1, Lcom/fulishe/fs/newvideo/cache/j;->a:I

    iget-boolean v4, p1, Lcom/fulishe/fs/newvideo/cache/g;->g:Z

    iput-boolean v4, v1, Lcom/fulishe/fs/newvideo/cache/j;->b:Z

    invoke-direct {p0, p1}, Lcom/fulishe/fs/newvideo/cache/h;->a(Lcom/fulishe/fs/newvideo/cache/g;)Z

    move-result v1

    if-eqz v1, :cond_2c

    invoke-direct {p0, v0, v2, v3}, Lcom/fulishe/fs/newvideo/cache/h;->a(Ljava/io/OutputStream;J)V

    :goto_2b
    return-void

    :cond_2c
    invoke-direct {p0, v0, v2, v3}, Lcom/fulishe/fs/newvideo/cache/h;->b(Ljava/io/OutputStream;J)V

    goto :goto_2b
.end method

.method public a(Ljava/lang/String;I)V
    .registers 4

    iget-object v0, p0, Lcom/fulishe/fs/newvideo/cache/h;->a:Lcom/fulishe/fs/newvideo/cache/j;

    if-eqz v0, :cond_7

    invoke-virtual {v0, p1, p2}, Lcom/fulishe/fs/newvideo/cache/j;->a(Ljava/lang/String;I)V

    :cond_7
    return-void
.end method