h.smali

.class public Lcn/jiguang/f/h;
.super Ljava/lang/Object;


# direct methods
.method public static a(Ljava/util/Collection;)Ljava/util/LinkedList;
    .registers 7
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "<T:",
            "Ljava/lang/Object;",
            ">(",
            "Ljava/util/Collection",
            "<TT;>;)",
            "Ljava/util/LinkedList",
            "<TT;>;"
        }
    .end annotation

    const/4 v0, 0x0

    new-instance v1, Ljava/util/LinkedList;

    invoke-direct {v1}, Ljava/util/LinkedList;-><init>()V

    if-eqz p0, :cond_10

    invoke-interface {p0}, Ljava/util/Collection;->size()I

    move-result v2

    :goto_c
    if-nez v2, :cond_12

    move-object v0, v1

    :goto_f
    return-object v0

    :cond_10
    move v2, v0

    goto :goto_c

    :cond_12
    const/4 v3, 0x1

    if-ne v2, v3, :cond_1a

    invoke-virtual {v1, p0}, Ljava/util/LinkedList;->addAll(Ljava/util/Collection;)Z

    move-object v0, v1

    goto :goto_f

    :cond_1a
    new-instance v2, Ljava/security/SecureRandom;

    invoke-direct {v2}, Ljava/security/SecureRandom;-><init>()V

    invoke-interface {p0}, Ljava/util/Collection;->iterator()Ljava/util/Iterator;

    move-result-object v3

    :goto_23
    invoke-interface {v3}, Ljava/util/Iterator;->hasNext()Z

    move-result v4

    if-eqz v4, :cond_37

    invoke-interface {v3}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v4

    add-int/lit8 v0, v0, 0x1

    invoke-virtual {v2, v0}, Ljava/util/Random;->nextInt(I)I

    move-result v5

    invoke-virtual {v1, v5, v4}, Ljava/util/LinkedList;->add(ILjava/lang/Object;)V

    goto :goto_23

    :cond_37
    move-object v0, v1

    goto :goto_f
.end method

.method public static a(Ljava/io/Closeable;)V
    .registers 2

    if-eqz p0, :cond_5

    :try_start_2
    invoke-interface {p0}, Ljava/io/Closeable;->close()V
    :try_end_5
    .catch Ljava/lang/Throwable; {:try_start_2 .. :try_end_5} :catch_6

    :cond_5
    :goto_5
    return-void

    :catch_6
    move-exception v0

    goto :goto_5
.end method

.method public static a(JJ)Z
    .registers 10

    const-wide/16 v4, 0x0

    const/4 v0, 0x1

    cmp-long v1, p2, v4

    if-gtz v1, :cond_d

    new-instance v0, Ljava/lang/AssertionError;

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

    throw v0

    :cond_d
    invoke-static {}, Landroid/os/SystemClock;->elapsedRealtime()J

    move-result-wide v2

    cmp-long v1, p0, v4

    if-gtz v1, :cond_16

    :cond_15
    :goto_15
    return v0

    :cond_16
    cmp-long v1, v2, p0

    if-lez v1, :cond_15

    add-long v4, p0, p2

    cmp-long v1, v2, v4

    if-gtz v1, :cond_15

    const/4 v0, 0x0

    goto :goto_15
.end method

.method public static a(Ljava/io/InputStream;)[B
    .registers 3

    if-nez p0, :cond_a

    new-instance v0, Ljava/io/IOException;

    const-string v1, "InputStream is null"

    invoke-direct {v0, v1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V

    throw v0

    :cond_a
    invoke-virtual {p0}, Ljava/io/InputStream;->available()I

    move-result v0

    new-array v0, v0, [B

    invoke-virtual {p0, v0}, Ljava/io/InputStream;->read([B)I

    return-object v0
.end method

.method public static a([B)[B
    .registers 5

    if-eqz p0, :cond_5

    array-length v0, p0

    if-nez v0, :cond_6

    :cond_5
    :goto_5
    return-object p0

    :cond_6
    new-instance v3, Ljava/io/ByteArrayOutputStream;

    invoke-direct {v3}, Ljava/io/ByteArrayOutputStream;-><init>()V

    const/4 v2, 0x0

    :try_start_c
    new-instance v1, Ljava/util/zip/GZIPOutputStream;

    invoke-direct {v1, v3}, Ljava/util/zip/GZIPOutputStream;-><init>(Ljava/io/OutputStream;)V
    :try_end_11
    .catchall {:try_start_c .. :try_end_11} :catchall_22

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

    invoke-virtual {v1}, Ljava/io/OutputStream;->close()V

    invoke-virtual {v3}, Ljava/io/ByteArrayOutputStream;->toByteArray()[B
    :try_end_1a
    .catchall {:try_start_11 .. :try_end_1a} :catchall_2b

    move-result-object p0

    invoke-static {v3}, Lcn/jiguang/f/h;->a(Ljava/io/Closeable;)V

    invoke-static {v1}, Lcn/jiguang/f/h;->a(Ljava/io/Closeable;)V

    goto :goto_5

    :catchall_22
    move-exception v0

    move-object v1, v2

    :goto_24
    invoke-static {v3}, Lcn/jiguang/f/h;->a(Ljava/io/Closeable;)V

    invoke-static {v1}, Lcn/jiguang/f/h;->a(Ljava/io/Closeable;)V

    throw v0

    :catchall_2b
    move-exception v0

    goto :goto_24
.end method

.method public static b(Ljava/io/InputStream;)[B
    .registers 5

    if-nez p0, :cond_a

    new-instance v0, Ljava/io/IOException;

    const-string v1, "InputStream is null"

    invoke-direct {v0, v1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V

    throw v0

    :cond_a
    const/4 v2, 0x0

    :try_start_b
    new-instance v1, Ljava/io/ByteArrayOutputStream;

    invoke-direct {v1}, Ljava/io/ByteArrayOutputStream;-><init>()V
    :try_end_10
    .catchall {:try_start_b .. :try_end_10} :catchall_2d

    const/16 v0, 0x400

    :try_start_12
    new-array v0, v0, [B

    :goto_14
    invoke-virtual {p0, v0}, Ljava/io/InputStream;->read([B)I

    move-result v2

    const/4 v3, -0x1

    if-eq v2, v3, :cond_25

    const/4 v3, 0x0

    invoke-virtual {v1, v0, v3, v2}, Ljava/io/ByteArrayOutputStream;->write([BII)V
    :try_end_1f
    .catchall {:try_start_12 .. :try_end_1f} :catchall_20

    goto :goto_14

    :catchall_20
    move-exception v0

    :goto_21
    invoke-static {v1}, Lcn/jiguang/f/h;->a(Ljava/io/Closeable;)V

    throw v0

    :cond_25
    :try_start_25
    invoke-virtual {v1}, Ljava/io/ByteArrayOutputStream;->toByteArray()[B
    :try_end_28
    .catchall {:try_start_25 .. :try_end_28} :catchall_20

    move-result-object v0

    invoke-static {v1}, Lcn/jiguang/f/h;->a(Ljava/io/Closeable;)V

    return-object v0

    :catchall_2d
    move-exception v0

    move-object v1, v2

    goto :goto_21
.end method

.method public static b([B)[B
    .registers 7

    if-eqz p0, :cond_5

    array-length v0, p0

    if-nez v0, :cond_6

    :cond_5
    :goto_5
    return-object p0

    :cond_6
    new-instance v3, Ljava/io/ByteArrayOutputStream;

    invoke-direct {v3}, Ljava/io/ByteArrayOutputStream;-><init>()V

    new-instance v4, Ljava/io/ByteArrayInputStream;

    invoke-direct {v4, p0}, Ljava/io/ByteArrayInputStream;-><init>([B)V

    const/4 v2, 0x0

    :try_start_11
    new-instance v1, Ljava/util/zip/GZIPInputStream;

    invoke-direct {v1, v4}, Ljava/util/zip/GZIPInputStream;-><init>(Ljava/io/InputStream;)V
    :try_end_16
    .catchall {:try_start_11 .. :try_end_16} :catchall_3e

    const/16 v0, 0x100

    :try_start_18
    new-array v0, v0, [B

    :goto_1a
    invoke-virtual {v1, v0}, Ljava/util/zip/GZIPInputStream;->read([B)I

    move-result v2

    if-ltz v2, :cond_30

    const/4 v5, 0x0

    invoke-virtual {v3, v0, v5, v2}, Ljava/io/ByteArrayOutputStream;->write([BII)V
    :try_end_24
    .catchall {:try_start_18 .. :try_end_24} :catchall_25

    goto :goto_1a

    :catchall_25
    move-exception v0

    :goto_26
    invoke-static {v3}, Lcn/jiguang/f/h;->a(Ljava/io/Closeable;)V

    invoke-static {v4}, Lcn/jiguang/f/h;->a(Ljava/io/Closeable;)V

    invoke-static {v1}, Lcn/jiguang/f/h;->a(Ljava/io/Closeable;)V

    throw v0

    :cond_30
    :try_start_30
    invoke-virtual {v3}, Ljava/io/ByteArrayOutputStream;->toByteArray()[B
    :try_end_33
    .catchall {:try_start_30 .. :try_end_33} :catchall_25

    move-result-object p0

    invoke-static {v3}, Lcn/jiguang/f/h;->a(Ljava/io/Closeable;)V

    invoke-static {v4}, Lcn/jiguang/f/h;->a(Ljava/io/Closeable;)V

    invoke-static {v1}, Lcn/jiguang/f/h;->a(Ljava/io/Closeable;)V

    goto :goto_5

    :catchall_3e
    move-exception v0

    move-object v1, v2

    goto :goto_26
.end method

.method public static c([B)S
    .registers 4

    const/4 v2, 0x1

    const/4 v1, 0x0

    if-eqz p0, :cond_7

    array-length v0, p0

    if-nez v0, :cond_f

    :cond_7
    new-instance v0, Ljava/lang/Exception;

    const-string v1, "byte could not be empty"

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

    throw v0

    :cond_f
    array-length v0, p0

    if-ne v0, v2, :cond_16

    aget-byte v0, p0, v1

    int-to-short v0, v0

    :goto_15
    return v0

    :cond_16
    aget-byte v0, p0, v1

    and-int/lit16 v0, v0, 0xff

    shl-int/lit8 v0, v0, 0x8

    int-to-short v0, v0

    aget-byte v1, p0, v2

    and-int/lit16 v1, v1, 0xff

    int-to-short v1, v1

    or-int/2addr v0, v1

    int-to-short v0, v0

    goto :goto_15
.end method