.class final Lkotlin/io/encoding/DecodeInputStream; .super Ljava/io/InputStream; .source "Base64IOStream.kt" # annotations .annotation runtime Lkotlin/Metadata; d1 = { "\u00002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0008\u0002\n\u0002\u0018\u0002\n\u0002\u0008\u0002\n\u0002\u0010\u0012\n\u0000\n\u0002\u0010\u0008\n\u0002\u0008\u0005\n\u0002\u0010\u000b\n\u0002\u0008\u0004\n\u0002\u0010\u0002\n\u0002\u0008\u000f\u0008\u0003\u0018\u00002\u00020\u0001B\u0015\u0012\u0006\u0010\u0002\u001a\u00020\u0001\u0012\u0006\u0010\u0003\u001a\u00020\u0004\u00a2\u0006\u0002\u0010\u0005J\u0008\u0010\u0013\u001a\u00020\u0014H\u0016J \u0010\u0015\u001a\u00020\u00142\u0006\u0010\u0016\u001a\u00020\u00072\u0006\u0010\u0017\u001a\u00020\t2\u0006\u0010\u0018\u001a\u00020\tH\u0002J(\u0010\u0019\u001a\u00020\t2\u0006\u0010\u0016\u001a\u00020\u00072\u0006\u0010\u0017\u001a\u00020\t2\u0006\u0010\u001a\u001a\u00020\t2\u0006\u0010\u001b\u001a\u00020\tH\u0002J\u0010\u0010\u001c\u001a\u00020\t2\u0006\u0010\u001b\u001a\u00020\tH\u0002J\u0008\u0010\u001d\u001a\u00020\tH\u0016J \u0010\u001d\u001a\u00020\t2\u0006\u0010\u001e\u001a\u00020\u00072\u0006\u0010\u001f\u001a\u00020\t2\u0006\u0010\u0018\u001a\u00020\tH\u0016J\u0008\u0010 \u001a\u00020\tH\u0002J\u0008\u0010!\u001a\u00020\u0014H\u0002J\u0008\u0010\"\u001a\u00020\u0014H\u0002R\u000e\u0010\u0003\u001a\u00020\u0004X\u0082\u0004\u00a2\u0006\u0002\n\u0000R\u000e\u0010\u0006\u001a\u00020\u0007X\u0082\u0004\u00a2\u0006\u0002\n\u0000R\u000e\u0010\u0008\u001a\u00020\tX\u0082\u000e\u00a2\u0006\u0002\n\u0000R\u0014\u0010\n\u001a\u00020\t8BX\u0082\u0004\u00a2\u0006\u0006\u001a\u0004\u0008\u000b\u0010\u000cR\u000e\u0010\r\u001a\u00020\tX\u0082\u000e\u00a2\u0006\u0002\n\u0000R\u000e\u0010\u0002\u001a\u00020\u0001X\u0082\u0004\u00a2\u0006\u0002\n\u0000R\u000e\u0010\u000e\u001a\u00020\u000fX\u0082\u000e\u00a2\u0006\u0002\n\u0000R\u000e\u0010\u0010\u001a\u00020\u000fX\u0082\u000e\u00a2\u0006\u0002\n\u0000R\u000e\u0010\u0011\u001a\u00020\u0007X\u0082\u0004\u00a2\u0006\u0002\n\u0000R\u000e\u0010\u0012\u001a\u00020\u0007X\u0082\u0004\u00a2\u0006\u0002\n\u0000\u00a8\u0006#" } d2 = { "Lkotlin/io/encoding/DecodeInputStream;", "Ljava/io/InputStream;", "input", "base64", "Lkotlin/io/encoding/Base64;", "(Ljava/io/InputStream;Lkotlin/io/encoding/Base64;)V", "byteBuffer", "", "byteBufferEndIndex", "", "byteBufferLength", "getByteBufferLength", "()I", "byteBufferStartIndex", "isClosed", "", "isEOF", "singleByteBuffer", "symbolBuffer", "close", "", "copyByteBufferInto", "dst", "dstOffset", "length", "decodeSymbolBufferInto", "dstEndIndex", "symbolBufferLength", "handlePaddingSymbol", "read", "destination", "offset", "readNextSymbol", "resetByteBufferIfEmpty", "shiftByteBufferToStartIfNeeded", "kotlin-stdlib" } k = 0x1 mv = { 0x1, 0x9, 0x0 } xi = 0x30 .end annotation # instance fields .field private final base64:Lkotlin/io/encoding/Base64; .field private final byteBuffer:[B .field private byteBufferEndIndex:I .field private byteBufferStartIndex:I .field private final input:Ljava/io/InputStream; .field private isClosed:Z .field private isEOF:Z .field private final singleByteBuffer:[B .field private final symbolBuffer:[B # direct methods .method public constructor (Ljava/io/InputStream;Lkotlin/io/encoding/Base64;)V .locals 1 const-string v0, "input" invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V const-string v0, "base64" invoke-static {p2, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V .line 67 invoke-direct {p0}, Ljava/io/InputStream;->()V iput-object p1, p0, Lkotlin/io/encoding/DecodeInputStream;->input:Ljava/io/InputStream; iput-object p2, p0, Lkotlin/io/encoding/DecodeInputStream;->base64:Lkotlin/io/encoding/Base64; const/4 p1, 0x1 new-array p1, p1, [B iput-object p1, p0, Lkotlin/io/encoding/DecodeInputStream;->singleByteBuffer:[B const/16 p1, 0x400 new-array p2, p1, [B iput-object p2, p0, Lkotlin/io/encoding/DecodeInputStream;->symbolBuffer:[B new-array p1, p1, [B iput-object p1, p0, Lkotlin/io/encoding/DecodeInputStream;->byteBuffer:[B return-void .end method .method private final copyByteBufferInto([BII)V .locals 3 iget-object v0, p0, Lkotlin/io/encoding/DecodeInputStream;->byteBuffer:[B iget v1, p0, Lkotlin/io/encoding/DecodeInputStream;->byteBufferStartIndex:I add-int v2, v1, p3 .line 173 invoke-static {v0, p1, p2, v1, v2}, Lkotlin/collections/ArraysKt;->copyInto([B[BIII)[B iget p1, p0, Lkotlin/io/encoding/DecodeInputStream;->byteBufferStartIndex:I add-int/2addr p1, p3 iput p1, p0, Lkotlin/io/encoding/DecodeInputStream;->byteBufferStartIndex:I .line 180 invoke-direct {p0}, Lkotlin/io/encoding/DecodeInputStream;->resetByteBufferIfEmpty()V return-void .end method .method private final decodeSymbolBufferInto([BIII)I .locals 7 iget v6, p0, Lkotlin/io/encoding/DecodeInputStream;->byteBufferEndIndex:I iget-object v0, p0, Lkotlin/io/encoding/DecodeInputStream;->base64:Lkotlin/io/encoding/Base64; iget-object v1, p0, Lkotlin/io/encoding/DecodeInputStream;->symbolBuffer:[B iget-object v2, p0, Lkotlin/io/encoding/DecodeInputStream;->byteBuffer:[B const/4 v4, 0x0 move v3, v6 move v5, p4 .line 158 invoke-virtual/range {v0 .. v5}, Lkotlin/io/encoding/Base64;->decodeIntoByteArray([B[BIII)I move-result p4 add-int/2addr v6, p4 iput v6, p0, Lkotlin/io/encoding/DecodeInputStream;->byteBufferEndIndex:I .line 166 invoke-direct {p0}, Lkotlin/io/encoding/DecodeInputStream;->getByteBufferLength()I move-result p4 sub-int/2addr p3, p2 invoke-static {p4, p3}, Ljava/lang/Math;->min(II)I move-result p3 .line 167 invoke-direct {p0, p1, p2, p3}, Lkotlin/io/encoding/DecodeInputStream;->copyByteBufferInto([BII)V .line 168 invoke-direct {p0}, Lkotlin/io/encoding/DecodeInputStream;->shiftByteBufferToStartIfNeeded()V return p3 .end method .method private final getByteBufferLength()I .locals 1 iget v0, p0, Lkotlin/io/encoding/DecodeInputStream;->byteBufferEndIndex:I iget p0, p0, Lkotlin/io/encoding/DecodeInputStream;->byteBufferStartIndex:I sub-int/2addr v0, p0 return v0 .end method .method private final handlePaddingSymbol(I)I .locals 3 iget-object v0, p0, Lkotlin/io/encoding/DecodeInputStream;->symbolBuffer:[B const/16 v1, 0x3d .line 202 aput-byte v1, v0, p1 and-int/lit8 v0, p1, 0x3 const/4 v1, 0x2 if-ne v0, v1, :cond_1 .line 206 invoke-direct {p0}, Lkotlin/io/encoding/DecodeInputStream;->readNextSymbol()I move-result v0 if-ltz v0, :cond_0 iget-object p0, p0, Lkotlin/io/encoding/DecodeInputStream;->symbolBuffer:[B add-int/lit8 v2, p1, 0x1 int-to-byte v0, v0 .line 208 aput-byte v0, p0, v2 :cond_0 add-int/2addr p1, v1 goto :goto_0 :cond_1 add-int/lit8 p1, p1, 0x1 :goto_0 return p1 .end method .method private final readNextSymbol()I .locals 2 iget-object v0, p0, Lkotlin/io/encoding/DecodeInputStream;->base64:Lkotlin/io/encoding/Base64; .line 218 invoke-virtual {v0}, Lkotlin/io/encoding/Base64;->isMimeScheme$kotlin_stdlib()Z move-result v0 if-nez v0, :cond_0 iget-object p0, p0, Lkotlin/io/encoding/DecodeInputStream;->input:Ljava/io/InputStream; .line 219 invoke-virtual {p0}, Ljava/io/InputStream;->read()I move-result p0 return p0 :cond_0 iget-object v0, p0, Lkotlin/io/encoding/DecodeInputStream;->input:Ljava/io/InputStream; .line 224 invoke-virtual {v0}, Ljava/io/InputStream;->read()I move-result v0 const/4 v1, -0x1 if-eq v0, v1, :cond_1 .line 225 invoke-static {v0}, Lkotlin/io/encoding/Base64Kt;->isInMimeAlphabet(I)Z move-result v1 if-eqz v1, :cond_0 :cond_1 return v0 .end method .method private final resetByteBufferIfEmpty()V .locals 2 iget v0, p0, Lkotlin/io/encoding/DecodeInputStream;->byteBufferStartIndex:I iget v1, p0, Lkotlin/io/encoding/DecodeInputStream;->byteBufferEndIndex:I if-ne v0, v1, :cond_0 const/4 v0, 0x0 iput v0, p0, Lkotlin/io/encoding/DecodeInputStream;->byteBufferStartIndex:I iput v0, p0, Lkotlin/io/encoding/DecodeInputStream;->byteBufferEndIndex:I :cond_0 return-void .end method .method private final shiftByteBufferToStartIfNeeded()V .locals 4 iget-object v0, p0, Lkotlin/io/encoding/DecodeInputStream;->byteBuffer:[B .line 192 array-length v1, v0 iget v2, p0, Lkotlin/io/encoding/DecodeInputStream;->byteBufferEndIndex:I sub-int/2addr v1, v2 iget-object v3, p0, Lkotlin/io/encoding/DecodeInputStream;->symbolBuffer:[B .line 193 array-length v3, v3 div-int/lit8 v3, v3, 0x4 mul-int/lit8 v3, v3, 0x3 if-le v3, v1, :cond_0 iget v1, p0, Lkotlin/io/encoding/DecodeInputStream;->byteBufferStartIndex:I const/4 v3, 0x0 .line 195 invoke-static {v0, v0, v3, v1, v2}, Lkotlin/collections/ArraysKt;->copyInto([B[BIII)[B iget v0, p0, Lkotlin/io/encoding/DecodeInputStream;->byteBufferEndIndex:I iget v1, p0, Lkotlin/io/encoding/DecodeInputStream;->byteBufferStartIndex:I sub-int/2addr v0, v1 iput v0, p0, Lkotlin/io/encoding/DecodeInputStream;->byteBufferEndIndex:I iput v3, p0, Lkotlin/io/encoding/DecodeInputStream;->byteBufferStartIndex:I :cond_0 return-void .end method # virtual methods .method public close()V .locals 1 iget-boolean v0, p0, Lkotlin/io/encoding/DecodeInputStream;->isClosed:Z if-nez v0, :cond_0 const/4 v0, 0x1 iput-boolean v0, p0, Lkotlin/io/encoding/DecodeInputStream;->isClosed:Z iget-object p0, p0, Lkotlin/io/encoding/DecodeInputStream;->input:Ljava/io/InputStream; .line 151 invoke-virtual {p0}, Ljava/io/InputStream;->close()V :cond_0 return-void .end method .method public read()I .locals 4 iget v0, p0, Lkotlin/io/encoding/DecodeInputStream;->byteBufferStartIndex:I iget v1, p0, Lkotlin/io/encoding/DecodeInputStream;->byteBufferEndIndex:I const/4 v2, 0x1 if-ge v0, v1, :cond_0 iget-object v1, p0, Lkotlin/io/encoding/DecodeInputStream;->byteBuffer:[B .line 82 aget-byte v1, v1, v0 and-int/lit16 v1, v1, 0xff add-int/2addr v0, v2 iput v0, p0, Lkotlin/io/encoding/DecodeInputStream;->byteBufferStartIndex:I .line 84 invoke-direct {p0}, Lkotlin/io/encoding/DecodeInputStream;->resetByteBufferIfEmpty()V return v1 :cond_0 iget-object v0, p0, Lkotlin/io/encoding/DecodeInputStream;->singleByteBuffer:[B const/4 v1, 0x0 .line 87 invoke-virtual {p0, v0, v1, v2}, Lkotlin/io/encoding/DecodeInputStream;->read([BII)I move-result v0 const/4 v3, -0x1 if-eq v0, v3, :cond_2 if-ne v0, v2, :cond_1 iget-object p0, p0, Lkotlin/io/encoding/DecodeInputStream;->singleByteBuffer:[B .line 89 aget-byte p0, p0, v1 and-int/lit16 v3, p0, 0xff goto :goto_0 :cond_1 new-instance p0, Ljava/lang/IllegalStateException; const-string v0, "Unreachable" .line 90 invoke-virtual {v0}, Ljava/lang/Object;->toString()Ljava/lang/String; move-result-object v0 invoke-direct {p0, v0}, Ljava/lang/IllegalStateException;->(Ljava/lang/String;)V throw p0 :cond_2 :goto_0 return v3 .end method .method public read([BII)I .locals 9 const-string v0, "destination" invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V if-ltz p2, :cond_b if-ltz p3, :cond_b add-int v0, p2, p3 .line 95 array-length v1, p1 if-gt v0, v1, :cond_b iget-boolean v1, p0, Lkotlin/io/encoding/DecodeInputStream;->isClosed:Z if-nez v1, :cond_a iget-boolean v1, p0, Lkotlin/io/encoding/DecodeInputStream;->isEOF:Z const/4 v2, -0x1 if-eqz v1, :cond_0 return v2 :cond_0 const/4 v1, 0x0 if-nez p3, :cond_1 return v1 .line 108 :cond_1 invoke-direct {p0}, Lkotlin/io/encoding/DecodeInputStream;->getByteBufferLength()I move-result v3 if-lt v3, p3, :cond_2 .line 109 invoke-direct {p0, p1, p2, p3}, Lkotlin/io/encoding/DecodeInputStream;->copyByteBufferInto([BII)V return p3 .line 113 :cond_2 invoke-direct {p0}, Lkotlin/io/encoding/DecodeInputStream;->getByteBufferLength()I move-result v3 sub-int/2addr p3, v3 add-int/lit8 p3, p3, 0x2 .line 114 div-int/lit8 p3, p3, 0x3 mul-int/lit8 p3, p3, 0x4 move v3, p2 :goto_0 iget-boolean v4, p0, Lkotlin/io/encoding/DecodeInputStream;->isEOF:Z if-nez v4, :cond_8 if-lez p3, :cond_8 iget-object v4, p0, Lkotlin/io/encoding/DecodeInputStream;->symbolBuffer:[B .line 121 array-length v4, v4 invoke-static {v4, p3}, Ljava/lang/Math;->min(II)I move-result v4 move v5, v1 :goto_1 iget-boolean v6, p0, Lkotlin/io/encoding/DecodeInputStream;->isEOF:Z if-nez v6, :cond_5 if-ge v5, v4, :cond_5 .line 124 invoke-direct {p0}, Lkotlin/io/encoding/DecodeInputStream;->readNextSymbol()I move-result v6 const/4 v7, 0x1 if-eq v6, v2, :cond_4 const/16 v8, 0x3d if-eq v6, v8, :cond_3 iget-object v7, p0, Lkotlin/io/encoding/DecodeInputStream;->symbolBuffer:[B int-to-byte v6, v6 .line 132 aput-byte v6, v7, v5 add-int/lit8 v5, v5, 0x1 goto :goto_1 .line 128 :cond_3 invoke-direct {p0, v5}, Lkotlin/io/encoding/DecodeInputStream;->handlePaddingSymbol(I)I move-result v5 iput-boolean v7, p0, Lkotlin/io/encoding/DecodeInputStream;->isEOF:Z goto :goto_1 :cond_4 iput-boolean v7, p0, Lkotlin/io/encoding/DecodeInputStream;->isEOF:Z goto :goto_1 :cond_5 if-nez v6, :cond_7 if-ne v5, v4, :cond_6 goto :goto_2 .line 138 :cond_6 new-instance p0, Ljava/lang/IllegalStateException; const-string p1, "Check failed." invoke-virtual {p1}, Ljava/lang/Object;->toString()Ljava/lang/String; move-result-object p1 invoke-direct {p0, p1}, Ljava/lang/IllegalStateException;->(Ljava/lang/String;)V throw p0 :cond_7 :goto_2 sub-int/2addr p3, v5 .line 142 invoke-direct {p0, p1, v3, v0, v5}, Lkotlin/io/encoding/DecodeInputStream;->decodeSymbolBufferInto([BIII)I move-result v4 add-int/2addr v3, v4 goto :goto_0 :cond_8 if-ne v3, p2, :cond_9 if-eqz v4, :cond_9 goto :goto_3 :cond_9 sub-int v2, v3, p2 :goto_3 return v2 .line 99 :cond_a new-instance p0, Ljava/io/IOException; const-string p1, "The input stream is closed." invoke-direct {p0, p1}, Ljava/io/IOException;->(Ljava/lang/String;)V throw p0 .line 96 :cond_b new-instance p0, Ljava/lang/IndexOutOfBoundsException; new-instance v0, Ljava/lang/StringBuilder; const-string v1, "offset: " invoke-direct {v0, v1}, Ljava/lang/StringBuilder;->(Ljava/lang/String;)V invoke-virtual {v0, p2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder; move-result-object p2 const-string v0, ", length: " invoke-virtual {p2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object p2 invoke-virtual {p2, p3}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder; move-result-object p2 const-string p3, ", buffer size: " invoke-virtual {p2, p3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object p2 array-length p1, p1 invoke-virtual {p2, p1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder; move-result-object p1 invoke-virtual {p1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object p1 invoke-direct {p0, p1}, Ljava/lang/IndexOutOfBoundsException;->(Ljava/lang/String;)V throw p0 .end method