dv.smali

.class public abstract Lcom/baidu/techain/af/dv;
.super Lcom/baidu/techain/af/j$a;


# instance fields
.field protected c:I

.field protected d:Landroid/content/Context;


# direct methods
.method public constructor <init>(Landroid/content/Context;I)V
    .registers 3

    invoke-direct {p0}, Lcom/baidu/techain/af/j$a;-><init>()V

    iput p2, p0, Lcom/baidu/techain/af/dv;->c:I

    iput-object p1, p0, Lcom/baidu/techain/af/dv;->d:Landroid/content/Context;

    return-void
.end method

.method public static a(Landroid/content/Context;Lcom/baidu/techain/af/hs;)V
    .registers 4

    .prologue
    .line 0
    invoke-static {}, Lcom/baidu/techain/af/dk;->a()Lcom/baidu/techain/af/dk;

    move-result-object v0

    .line 4000
    iget-object v0, v0, Lcom/baidu/techain/af/dk;->a:Lcom/baidu/techain/af/dj;

    .line 0
    if-nez v0, :cond_11

    const-string v0, ""

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

    move-result v1

    if-eqz v1, :cond_16

    :cond_10
    :goto_10
    return-void

    :cond_11
    invoke-interface {v0}, Lcom/baidu/techain/af/dj;->a()Ljava/lang/String;

    move-result-object v0

    goto :goto_a

    .line 5000
    :cond_16
    iget-object v1, p1, Lcom/baidu/techain/af/hs;->c:Ljava/lang/String;

    .line 0
    invoke-static {v1}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v1

    if-nez v1, :cond_10

    invoke-static {p0, p1, v0}, Lcom/baidu/techain/af/dv;->a(Landroid/content/Context;Lcom/baidu/techain/af/hs;Ljava/lang/String;)V

    goto :goto_10
.end method

.method private static a(Landroid/content/Context;Lcom/baidu/techain/af/hs;Ljava/lang/String;)V
    .registers 12

    const/4 v2, 0x0

    invoke-static {p1}, Lcom/baidu/techain/af/iu;->a(Lcom/baidu/techain/af/iv;)[B

    move-result-object v0

    invoke-static {p2, v0}, Lcom/baidu/techain/af/dn;->b(Ljava/lang/String;[B)[B

    move-result-object v0

    if-eqz v0, :cond_e

    array-length v1, v0

    if-nez v1, :cond_f

    :cond_e
    :goto_e
    return-void

    :cond_f
    sget-object v5, Lcom/baidu/techain/af/do;->a:Ljava/lang/Object;

    monitor-enter v5

    :try_start_12
    new-instance v1, Ljava/io/File;

    const/4 v3, 0x0

    invoke-virtual {p0, v3}, Landroid/content/Context;->getExternalFilesDir(Ljava/lang/String;)Ljava/io/File;

    move-result-object v3

    const-string v4, "push_cdata.lock"

    invoke-direct {v1, v3, v4}, Ljava/io/File;-><init>(Ljava/io/File;Ljava/lang/String;)V

    invoke-static {v1}, Lcom/baidu/techain/af/ke;->c(Ljava/io/File;)Z

    new-instance v4, Ljava/io/RandomAccessFile;

    const-string v3, "rw"

    invoke-direct {v4, v1, v3}, Ljava/io/RandomAccessFile;-><init>(Ljava/io/File;Ljava/lang/String;)V
    :try_end_28
    .catch Ljava/io/IOException; {:try_start_12 .. :try_end_28} :catch_6b
    .catchall {:try_start_12 .. :try_end_28} :catchall_83

    :try_start_28
    invoke-virtual {v4}, Ljava/io/RandomAccessFile;->getChannel()Ljava/nio/channels/FileChannel;

    move-result-object v1

    invoke-virtual {v1}, Ljava/nio/channels/FileChannel;->lock()Ljava/nio/channels/FileLock;
    :try_end_2f
    .catch Ljava/io/IOException; {:try_start_28 .. :try_end_2f} :catch_ab
    .catchall {:try_start_28 .. :try_end_2f} :catchall_9e

    move-result-object v3

    :try_start_30
    new-instance v6, Ljava/io/File;

    const/4 v1, 0x0

    invoke-virtual {p0, v1}, Landroid/content/Context;->getExternalFilesDir(Ljava/lang/String;)Ljava/io/File;

    move-result-object v1

    const-string v7, "push_cdata.data"

    invoke-direct {v6, v1, v7}, Ljava/io/File;-><init>(Ljava/io/File;Ljava/lang/String;)V

    new-instance v1, Ljava/io/BufferedOutputStream;

    new-instance v7, Ljava/io/FileOutputStream;

    const/4 v8, 0x1

    invoke-direct {v7, v6, v8}, Ljava/io/FileOutputStream;-><init>(Ljava/io/File;Z)V

    invoke-direct {v1, v7}, Ljava/io/BufferedOutputStream;-><init>(Ljava/io/OutputStream;)V
    :try_end_47
    .catch Ljava/io/IOException; {:try_start_30 .. :try_end_47} :catch_af
    .catchall {:try_start_30 .. :try_end_47} :catchall_a1

    :try_start_47
    array-length v2, v0

    invoke-static {v2}, Lcom/baidu/techain/af/d;->a(I)[B

    move-result-object v2

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

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

    invoke-virtual {v1}, Ljava/io/BufferedOutputStream;->flush()V
    :try_end_55
    .catch Ljava/io/IOException; {:try_start_47 .. :try_end_55} :catch_b4
    .catchall {:try_start_47 .. :try_end_55} :catchall_a3

    if-eqz v3, :cond_60

    :try_start_57
    invoke-virtual {v3}, Ljava/nio/channels/FileLock;->isValid()Z
    :try_end_5a
    .catchall {:try_start_57 .. :try_end_5a} :catchall_68

    move-result v0

    if-eqz v0, :cond_60

    :try_start_5d
    invoke-virtual {v3}, Ljava/nio/channels/FileLock;->release()V
    :try_end_60
    .catch Ljava/io/IOException; {:try_start_5d .. :try_end_60} :catch_98
    .catchall {:try_start_5d .. :try_end_60} :catchall_68

    :cond_60
    :goto_60
    :try_start_60
    invoke-static {v1}, Lcom/baidu/techain/af/ke;->a(Ljava/io/Closeable;)V

    invoke-static {v4}, Lcom/baidu/techain/af/ke;->a(Ljava/io/Closeable;)V

    :goto_66
    monitor-exit v5

    goto :goto_e

    :catchall_68
    move-exception v0

    monitor-exit v5
    :try_end_6a
    .catchall {:try_start_60 .. :try_end_6a} :catchall_68

    throw v0

    :catch_6b
    move-exception v0

    move-object v1, v2

    move-object v3, v2

    :goto_6e
    :try_start_6e
    invoke-virtual {v0}, Ljava/io/IOException;->printStackTrace()V
    :try_end_71
    .catchall {:try_start_6e .. :try_end_71} :catchall_a6

    if-eqz v2, :cond_7c

    :try_start_73
    invoke-virtual {v2}, Ljava/nio/channels/FileLock;->isValid()Z
    :try_end_76
    .catchall {:try_start_73 .. :try_end_76} :catchall_68

    move-result v0

    if-eqz v0, :cond_7c

    :try_start_79
    invoke-virtual {v2}, Ljava/nio/channels/FileLock;->release()V
    :try_end_7c
    .catch Ljava/io/IOException; {:try_start_79 .. :try_end_7c} :catch_9a
    .catchall {:try_start_79 .. :try_end_7c} :catchall_68

    :cond_7c
    :goto_7c
    :try_start_7c
    invoke-static {v1}, Lcom/baidu/techain/af/ke;->a(Ljava/io/Closeable;)V

    invoke-static {v3}, Lcom/baidu/techain/af/ke;->a(Ljava/io/Closeable;)V

    goto :goto_66

    :catchall_83
    move-exception v0

    move-object v3, v2

    move-object v4, v2

    :goto_86
    if-eqz v3, :cond_91

    invoke-virtual {v3}, Ljava/nio/channels/FileLock;->isValid()Z
    :try_end_8b
    .catchall {:try_start_7c .. :try_end_8b} :catchall_68

    move-result v1

    if-eqz v1, :cond_91

    :try_start_8e
    invoke-virtual {v3}, Ljava/nio/channels/FileLock;->release()V
    :try_end_91
    .catch Ljava/io/IOException; {:try_start_8e .. :try_end_91} :catch_9c
    .catchall {:try_start_8e .. :try_end_91} :catchall_68

    :cond_91
    :goto_91
    :try_start_91
    invoke-static {v2}, Lcom/baidu/techain/af/ke;->a(Ljava/io/Closeable;)V

    invoke-static {v4}, Lcom/baidu/techain/af/ke;->a(Ljava/io/Closeable;)V

    throw v0
    :try_end_98
    .catchall {:try_start_91 .. :try_end_98} :catchall_68

    :catch_98
    move-exception v0

    goto :goto_60

    :catch_9a
    move-exception v0

    goto :goto_7c

    :catch_9c
    move-exception v1

    goto :goto_91

    :catchall_9e
    move-exception v0

    move-object v3, v2

    goto :goto_86

    :catchall_a1
    move-exception v0

    goto :goto_86

    :catchall_a3
    move-exception v0

    move-object v2, v1

    goto :goto_86

    :catchall_a6
    move-exception v0

    move-object v4, v3

    move-object v3, v2

    move-object v2, v1

    goto :goto_86

    :catch_ab
    move-exception v0

    move-object v1, v2

    move-object v3, v4

    goto :goto_6e

    :catch_af
    move-exception v0

    move-object v1, v2

    move-object v2, v3

    move-object v3, v4

    goto :goto_6e

    :catch_b4
    move-exception v0

    move-object v2, v3

    move-object v3, v4

    goto :goto_6e
.end method


# virtual methods
.method public abstract b()Ljava/lang/String;
.end method

.method public abstract c()Lcom/baidu/techain/af/hm;
.end method

.method protected d()Z
    .registers 5

    iget-object v0, p0, Lcom/baidu/techain/af/dv;->d:Landroid/content/Context;

    invoke-virtual {p0}, Lcom/baidu/techain/af/dv;->a()I

    move-result v1

    invoke-static {v1}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

    move-result-object v1

    iget v2, p0, Lcom/baidu/techain/af/dv;->c:I

    int-to-long v2, v2

    invoke-static {v0, v1, v2, v3}, Lcom/baidu/techain/af/h;->a(Landroid/content/Context;Ljava/lang/String;J)Z

    move-result v0

    return v0
.end method

.method public run()V
    .registers 7

    .prologue
    .line 0
    invoke-virtual {p0}, Lcom/baidu/techain/af/dv;->d()Z

    move-result v0

    if-nez v0, :cond_7

    :cond_6
    :goto_6
    return-void

    :cond_7
    invoke-static {}, Lcom/baidu/techain/af/dk;->a()Lcom/baidu/techain/af/dk;

    move-result-object v0

    .line 1000
    iget-object v0, v0, Lcom/baidu/techain/af/dk;->a:Lcom/baidu/techain/af/dj;

    .line 0
    if-nez v0, :cond_3b

    const-string v0, ""

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

    move-result v1

    if-nez v1, :cond_6

    invoke-virtual {p0}, Lcom/baidu/techain/af/dv;->b()Ljava/lang/String;

    move-result-object v1

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

    move-result v2

    if-nez v2, :cond_6

    new-instance v2, Lcom/baidu/techain/af/hs;

    invoke-direct {v2}, Lcom/baidu/techain/af/hs;-><init>()V

    .line 2000
    iput-object v1, v2, Lcom/baidu/techain/af/hs;->c:Ljava/lang/String;

    .line 0
    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v4

    invoke-virtual {v2, v4, v5}, Lcom/baidu/techain/af/hs;->a(J)Lcom/baidu/techain/af/hs;

    invoke-virtual {p0}, Lcom/baidu/techain/af/dv;->c()Lcom/baidu/techain/af/hm;

    move-result-object v1

    .line 3000
    iput-object v1, v2, Lcom/baidu/techain/af/hs;->b:Lcom/baidu/techain/af/hm;

    .line 0
    iget-object v1, p0, Lcom/baidu/techain/af/dv;->d:Landroid/content/Context;

    invoke-static {v1, v2, v0}, Lcom/baidu/techain/af/dv;->a(Landroid/content/Context;Lcom/baidu/techain/af/hs;Ljava/lang/String;)V

    goto :goto_6

    :cond_3b
    invoke-interface {v0}, Lcom/baidu/techain/af/dj;->a()Ljava/lang/String;

    move-result-object v0

    goto :goto_11
.end method