OpenSSLBIOInputStream.smali

.class Lorg/conscrypt/OpenSSLBIOInputStream;
.super Ljava/io/FilterInputStream;
.source ""


# instance fields
.field private ctx:J


# direct methods
.method constructor <init>(Ljava/io/InputStream;Z)V
    .registers 3

    invoke-direct {p0, p1}, Ljava/io/FilterInputStream;-><init>(Ljava/io/InputStream;)V

    invoke-static {p0, p2}, Lorg/conscrypt/NativeCrypto;->create_BIO_InputStream(Lorg/conscrypt/OpenSSLBIOInputStream;Z)J

    move-result-wide p1

    iput-wide p1, p0, Lorg/conscrypt/OpenSSLBIOInputStream;->ctx:J

    return-void
.end method


# virtual methods
.method getBioContext()J
    .registers 3

    iget-wide v0, p0, Lorg/conscrypt/OpenSSLBIOInputStream;->ctx:J

    return-wide v0
.end method

.method gets([B)I
    .registers 5

    const/4 v0, 0x0

    if-eqz p1, :cond_20

    array-length v1, p1

    if-nez v1, :cond_7

    goto :goto_20

    :cond_7
    :goto_7
    array-length v1, p1

    if-ge v0, v1, :cond_20

    invoke-virtual {p0}, Ljava/io/FilterInputStream;->read()I

    move-result v1

    const/4 v2, -0x1

    if-ne v1, v2, :cond_12

    goto :goto_20

    :cond_12
    const/16 v2, 0xa

    if-ne v1, v2, :cond_19

    if-nez v0, :cond_20

    goto :goto_7

    :cond_19
    add-int/lit8 v2, v0, 0x1

    int-to-byte v1, v1

    aput-byte v1, p1, v0

    move v0, v2

    goto :goto_7

    :cond_20
    :goto_20
    return v0
.end method

.method public read([B)I
    .registers 4

    array-length v0, p1

    const/4 v1, 0x0

    invoke-virtual {p0, p1, v1, v0}, Lorg/conscrypt/OpenSSLBIOInputStream;->read([BII)I

    move-result p1

    return p1
.end method

.method public read([BII)I
    .registers 7

    if-ltz p2, :cond_23

    if-ltz p3, :cond_23

    array-length v0, p1

    sub-int/2addr v0, p2

    if-gt p3, v0, :cond_23

    const/4 v0, 0x0

    if-nez p3, :cond_c

    return v0

    :cond_c
    add-int v1, p2, v0

    sub-int v2, p3, v0

    sub-int/2addr v2, p2

    invoke-super {p0, p1, v1, v2}, Ljava/io/FilterInputStream;->read([BII)I

    move-result v1

    const/4 v2, -0x1

    if-ne v1, v2, :cond_19

    goto :goto_1e

    :cond_19
    add-int/2addr v0, v1

    add-int v1, p2, v0

    if-lt v1, p3, :cond_c

    :goto_1e
    if-nez v0, :cond_21

    goto :goto_22

    :cond_21
    move v2, v0

    :goto_22
    return v2

    :cond_23
    new-instance p1, Ljava/lang/IndexOutOfBoundsException;

    const-string p2, "Invalid bounds"

    invoke-direct {p1, p2}, Ljava/lang/IndexOutOfBoundsException;-><init>(Ljava/lang/String;)V

    goto :goto_2c

    :goto_2b
    throw p1

    :goto_2c
    goto :goto_2b
.end method

.method release()V
    .registers 3

    iget-wide v0, p0, Lorg/conscrypt/OpenSSLBIOInputStream;->ctx:J

    invoke-static {v0, v1}, Lorg/conscrypt/NativeCrypto;->BIO_free_all(J)V

    return-void
.end method