ImageFormatCheckerUtils.smali

.class public Lcom/facebook/imageformat/ImageFormatCheckerUtils;
.super Ljava/lang/Object;
.source "ImageFormatCheckerUtils.java"


# direct methods
.method private constructor <init>()V
    .registers 1

    .line 110
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

.method public static asciiBytes(Ljava/lang/String;)[B
    .registers 3
    .annotation system Ldalvik/annotation/MethodParameters;
        accessFlags = {
            0x0
        }
        names = {
            "value"
        }
    .end annotation

    .line 26
    invoke-static {p0}, Lcom/facebook/common/internal/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;

    :try_start_3
    const-string v0, "ASCII"

    .line 28
    invoke-virtual {p0, v0}, Ljava/lang/String;->getBytes(Ljava/lang/String;)[B

    move-result-object p0
    :try_end_9
    .catch Ljava/io/UnsupportedEncodingException; {:try_start_3 .. :try_end_9} :catch_a

    return-object p0

    :catch_a
    move-exception p0

    .line 31
    new-instance v0, Ljava/lang/RuntimeException;

    const-string v1, "ASCII not found!"

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

    throw v0
.end method

.method public static hasPatternAt([B[BI)Z
    .registers 7
    .annotation system Ldalvik/annotation/MethodParameters;
        accessFlags = {
            0x10,
            0x10,
            0x0
        }
        names = {
            "byteArray",
            "pattern",
            "offset"
        }
    .end annotation

    .line 56
    invoke-static {p0}, Lcom/facebook/common/internal/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;

    .line 57
    invoke-static {p1}, Lcom/facebook/common/internal/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;

    .line 58
    array-length v0, p1

    add-int/2addr v0, p2

    array-length v1, p0

    const/4 v2, 0x0

    if-le v0, v1, :cond_d

    return v2

    :cond_d
    move v0, v2

    .line 62
    :goto_e
    array-length v1, p1

    if-ge v0, v1, :cond_1d

    add-int v1, p2, v0

    .line 63
    aget-byte v1, p0, v1

    aget-byte v3, p1, v0

    if-eq v1, v3, :cond_1a

    return v2

    :cond_1a
    add-int/lit8 v0, v0, 0x1

    goto :goto_e

    :cond_1d
    const/4 p0, 0x1

    return p0
.end method

.method public static indexOfPattern([BI[BI)I
    .registers 12
    .annotation system Ldalvik/annotation/MethodParameters;
        accessFlags = {
            0x10,
            0x10,
            0x10,
            0x10
        }
        names = {
            "byteArray",
            "byteArrayLen",
            "pattern",
            "patternLen"
        }
    .end annotation

    .line 80
    invoke-static {p0}, Lcom/facebook/common/internal/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;

    .line 81
    invoke-static {p2}, Lcom/facebook/common/internal/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;

    const/4 v0, -0x1

    if-le p3, p1, :cond_a

    return v0

    :cond_a
    const/4 v1, 0x0

    .line 86
    aget-byte v2, p2, v1

    sub-int/2addr p1, p3

    :goto_e
    if-gt v1, p1, :cond_37

    .line 91
    aget-byte v3, p0, v1

    const/4 v4, 0x1

    if-eq v3, v2, :cond_1d

    :goto_15
    add-int/2addr v1, v4

    if-gt v1, p1, :cond_1d

    .line 92
    aget-byte v3, p0, v1

    if-eq v3, v2, :cond_1d

    goto :goto_15

    :cond_1d
    if-gt v1, p1, :cond_34

    add-int/lit8 v3, v1, 0x1

    add-int v5, v3, p3

    sub-int/2addr v5, v4

    :goto_24
    if-ge v3, v5, :cond_31

    .line 99
    aget-byte v6, p0, v3

    aget-byte v7, p2, v4

    if-ne v6, v7, :cond_31

    add-int/lit8 v3, v3, 0x1

    add-int/lit8 v4, v4, 0x1

    goto :goto_24

    :cond_31
    if-ne v3, v5, :cond_34

    return v1

    :cond_34
    add-int/lit8 v1, v1, 0x1

    goto :goto_e

    :cond_37
    return v0
.end method

.method public static startsWithPattern([B[B)Z
    .registers 3
    .annotation system Ldalvik/annotation/MethodParameters;
        accessFlags = {
            0x10,
            0x10
        }
        names = {
            "byteArray",
            "pattern"
        }
    .end annotation

    const/4 v0, 0x0

    .line 44
    invoke-static {p0, p1, v0}, Lcom/facebook/imageformat/ImageFormatCheckerUtils;->hasPatternAt([B[BI)Z

    move-result p0

    return p0
.end method