Initial import of ADIF API reverse-engineering toolkit

This commit is contained in:
2025-12-16 08:37:56 +01:00
commit 60388529c1
11486 changed files with 1086536 additions and 0 deletions

View File

@@ -0,0 +1,551 @@
package kotlin.io.encoding;
import C.w;
import com.google.android.gms.measurement.internal.a;
import com.google.firebase.analytics.FirebaseAnalytics;
import java.nio.charset.Charset;
import kotlin.Metadata;
import kotlin.SinceKotlin;
import kotlin.UByte;
import kotlin.collections.AbstractList;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.CharsKt;
import kotlin.text.Charsets;
@ExperimentalEncodingApi
@SinceKotlin(version = "1.8")
@Metadata(d1 = {"\u0000B\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0006\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\u0012\n\u0002\b\u0002\n\u0002\u0010\r\n\u0000\n\u0002\u0010\b\n\u0002\b\u0003\n\u0002\u0010\u0002\n\u0002\b\u0012\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\n\b\u0017\u0018\u0000 22\u00020\u0001:\u00012B\u0017\b\u0002\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0003¢\u0006\u0002\u0010\u0005J\u0015\u0010\t\u001a\u00020\n2\u0006\u0010\u000b\u001a\u00020\fH\u0000¢\u0006\u0002\b\rJ%\u0010\u000e\u001a\u00020\f2\u0006\u0010\u000b\u001a\u00020\u000f2\u0006\u0010\u0010\u001a\u00020\u00112\u0006\u0010\u0012\u001a\u00020\u0011H\u0000¢\u0006\u0002\b\u0013J \u0010\u0014\u001a\u00020\u00152\u0006\u0010\u0016\u001a\u00020\u00112\u0006\u0010\u0017\u001a\u00020\u00112\u0006\u0010\u0018\u001a\u00020\u0011H\u0002J%\u0010\u0019\u001a\u00020\u00152\u0006\u0010\u001a\u001a\u00020\u00112\u0006\u0010\u0010\u001a\u00020\u00112\u0006\u0010\u0012\u001a\u00020\u0011H\u0000¢\u0006\u0002\b\u001bJ\"\u0010\u001c\u001a\u00020\f2\u0006\u0010\u000b\u001a\u00020\f2\b\b\u0002\u0010\u0010\u001a\u00020\u00112\b\b\u0002\u0010\u0012\u001a\u00020\u0011J\"\u0010\u001c\u001a\u00020\f2\u0006\u0010\u000b\u001a\u00020\u000f2\b\b\u0002\u0010\u0010\u001a\u00020\u00112\b\b\u0002\u0010\u0012\u001a\u00020\u0011J0\u0010\u001d\u001a\u00020\u00112\u0006\u0010\u000b\u001a\u00020\f2\u0006\u0010\u001e\u001a\u00020\f2\u0006\u0010\u0017\u001a\u00020\u00112\u0006\u0010\u0010\u001a\u00020\u00112\u0006\u0010\u0012\u001a\u00020\u0011H\u0002J4\u0010\u001f\u001a\u00020\u00112\u0006\u0010\u000b\u001a\u00020\f2\u0006\u0010\u001e\u001a\u00020\f2\b\b\u0002\u0010\u0017\u001a\u00020\u00112\b\b\u0002\u0010\u0010\u001a\u00020\u00112\b\b\u0002\u0010\u0012\u001a\u00020\u0011J4\u0010\u001f\u001a\u00020\u00112\u0006\u0010\u000b\u001a\u00020\u000f2\u0006\u0010\u001e\u001a\u00020\f2\b\b\u0002\u0010\u0017\u001a\u00020\u00112\b\b\u0002\u0010\u0010\u001a\u00020\u00112\b\b\u0002\u0010\u0012\u001a\u00020\u0011J \u0010 \u001a\u00020\u00112\u0006\u0010\u000b\u001a\u00020\f2\u0006\u0010\u0010\u001a\u00020\u00112\u0006\u0010\u0012\u001a\u00020\u0011H\u0002J\"\u0010!\u001a\u00020\n2\u0006\u0010\u000b\u001a\u00020\f2\b\b\u0002\u0010\u0010\u001a\u00020\u00112\b\b\u0002\u0010\u0012\u001a\u00020\u0011J4\u0010\"\u001a\u00020\u00112\u0006\u0010\u000b\u001a\u00020\f2\u0006\u0010\u001e\u001a\u00020\f2\b\b\u0002\u0010\u0017\u001a\u00020\u00112\b\b\u0002\u0010\u0010\u001a\u00020\u00112\b\b\u0002\u0010\u0012\u001a\u00020\u0011J5\u0010#\u001a\u00020\u00112\u0006\u0010\u000b\u001a\u00020\f2\u0006\u0010\u001e\u001a\u00020\f2\u0006\u0010\u0017\u001a\u00020\u00112\u0006\u0010\u0010\u001a\u00020\u00112\u0006\u0010\u0012\u001a\u00020\u0011H\u0000¢\u0006\u0002\b$J\u0010\u0010%\u001a\u00020\u00112\u0006\u0010\u001a\u001a\u00020\u0011H\u0002J=\u0010&\u001a\u0002H'\"\f\b\u0000\u0010'*\u00060(j\u0002`)2\u0006\u0010\u000b\u001a\u00020\f2\u0006\u0010\u001e\u001a\u0002H'2\b\b\u0002\u0010\u0010\u001a\u00020\u00112\b\b\u0002\u0010\u0012\u001a\u00020\u0011¢\u0006\u0002\u0010*J\"\u0010+\u001a\u00020\f2\u0006\u0010\u000b\u001a\u00020\f2\b\b\u0002\u0010\u0010\u001a\u00020\u00112\b\b\u0002\u0010\u0012\u001a\u00020\u0011J%\u0010,\u001a\u00020\f2\u0006\u0010\u000b\u001a\u00020\f2\u0006\u0010\u0010\u001a\u00020\u00112\u0006\u0010\u0012\u001a\u00020\u0011H\u0000¢\u0006\u0002\b-J(\u0010.\u001a\u00020\u00112\u0006\u0010\u000b\u001a\u00020\f2\u0006\u0010/\u001a\u00020\u00112\u0006\u0010\u0012\u001a\u00020\u00112\u0006\u00100\u001a\u00020\u0011H\u0002J \u00101\u001a\u00020\u00112\u0006\u0010\u000b\u001a\u00020\f2\u0006\u0010\u0010\u001a\u00020\u00112\u0006\u0010\u0012\u001a\u00020\u0011H\u0002R\u0014\u0010\u0004\u001a\u00020\u0003X\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0006\u0010\u0007R\u0014\u0010\u0002\u001a\u00020\u0003X\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b\b\u0010\u0007¨\u00063"}, d2 = {"Lkotlin/io/encoding/Base64;", "", "isUrlSafe", "", "isMimeScheme", "(ZZ)V", "isMimeScheme$kotlin_stdlib", "()Z", "isUrlSafe$kotlin_stdlib", "bytesToStringImpl", "", "source", "", "bytesToStringImpl$kotlin_stdlib", "charsToBytesImpl", "", "startIndex", "", "endIndex", "charsToBytesImpl$kotlin_stdlib", "checkDestinationBounds", "", "destinationSize", "destinationOffset", "capacityNeeded", "checkSourceBounds", "sourceSize", "checkSourceBounds$kotlin_stdlib", "decode", "decodeImpl", FirebaseAnalytics.Param.DESTINATION, "decodeIntoByteArray", "decodeSize", "encode", "encodeIntoByteArray", "encodeIntoByteArrayImpl", "encodeIntoByteArrayImpl$kotlin_stdlib", "encodeSize", "encodeToAppendable", "A", "Ljava/lang/Appendable;", "Lkotlin/text/Appendable;", "([BLjava/lang/Appendable;II)Ljava/lang/Appendable;", "encodeToByteArray", "encodeToByteArrayImpl", "encodeToByteArrayImpl$kotlin_stdlib", "handlePaddingSymbol", "padIndex", "byteStart", "skipIllegalSymbolsIfMime", "Default", "kotlin-stdlib"}, k = 1, mv = {1, 9, 0}, xi = 48)
/* loaded from: classes3.dex */
public class Base64 {
private static final int bitsPerByte = 8;
private static final int bitsPerSymbol = 6;
public static final int bytesPerGroup = 3;
private static final int mimeGroupsPerLine = 19;
public static final int mimeLineLength = 76;
public static final byte padSymbol = 61;
public static final int symbolsPerGroup = 4;
private final boolean isMimeScheme;
private final boolean isUrlSafe;
/* renamed from: Default, reason: from kotlin metadata */
public static final Companion INSTANCE = new Companion(null);
private static final byte[] mimeLineSeparatorSymbols = {13, 10};
private static final Base64 UrlSafe = new Base64(true, false);
private static final Base64 Mime = new Base64(false, true);
@Metadata(d1 = {"\u0000$\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0010\b\n\u0002\b\u0005\n\u0002\u0010\u0012\n\u0002\b\u0003\n\u0002\u0010\u0005\n\u0002\b\u0002\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002R\u0011\u0010\u0003\u001a\u00020\u0001¢\u0006\b\n\u0000\u001a\u0004\b\u0004\u0010\u0005R\u0011\u0010\u0006\u001a\u00020\u0001¢\u0006\b\n\u0000\u001a\u0004\b\u0007\u0010\u0005R\u000e\u0010\b\u001a\u00020\tX\u0082T¢\u0006\u0002\n\u0000R\u000e\u0010\n\u001a\u00020\tX\u0082T¢\u0006\u0002\n\u0000R\u000e\u0010\u000b\u001a\u00020\tX\u0080T¢\u0006\u0002\n\u0000R\u000e\u0010\f\u001a\u00020\tX\u0082T¢\u0006\u0002\n\u0000R\u000e\u0010\r\u001a\u00020\tX\u0080T¢\u0006\u0002\n\u0000R\u0014\u0010\u000e\u001a\u00020\u000fX\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0010\u0010\u0011R\u000e\u0010\u0012\u001a\u00020\u0013X\u0080T¢\u0006\u0002\n\u0000R\u000e\u0010\u0014\u001a\u00020\tX\u0080T¢\u0006\u0002\n\u0000¨\u0006\u0015"}, d2 = {"Lkotlin/io/encoding/Base64$Default;", "Lkotlin/io/encoding/Base64;", "()V", "Mime", "getMime", "()Lkotlin/io/encoding/Base64;", "UrlSafe", "getUrlSafe", "bitsPerByte", "", "bitsPerSymbol", "bytesPerGroup", "mimeGroupsPerLine", "mimeLineLength", "mimeLineSeparatorSymbols", "", "getMimeLineSeparatorSymbols$kotlin_stdlib", "()[B", "padSymbol", "", "symbolsPerGroup", "kotlin-stdlib"}, k = 1, mv = {1, 9, 0}, xi = 48)
/* renamed from: kotlin.io.encoding.Base64$Default, reason: from kotlin metadata */
/* loaded from: classes3.dex */
public static final class Companion extends Base64 {
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
public final Base64 getMime() {
return Base64.Mime;
}
public final byte[] getMimeLineSeparatorSymbols$kotlin_stdlib() {
return Base64.mimeLineSeparatorSymbols;
}
public final Base64 getUrlSafe() {
return Base64.UrlSafe;
}
/* JADX WARN: Illegal instructions before constructor call */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
private Companion() {
/*
r2 = this;
r0 = 0
r1 = 0
r2.<init>(r0, r0, r1)
return
*/
throw new UnsupportedOperationException("Method not decompiled: kotlin.io.encoding.Base64.Companion.<init>():void");
}
}
public /* synthetic */ Base64(boolean z3, boolean z4, DefaultConstructorMarker defaultConstructorMarker) {
this(z3, z4);
}
private final void checkDestinationBounds(int destinationSize, int destinationOffset, int capacityNeeded) {
if (destinationOffset < 0 || destinationOffset > destinationSize) {
throw new IndexOutOfBoundsException(w.k("destination offset: ", destinationOffset, destinationSize, ", destination size: "));
}
int i = destinationOffset + capacityNeeded;
if (i < 0 || i > destinationSize) {
throw new IndexOutOfBoundsException("The destination array does not have enough capacity, destination offset: " + destinationOffset + ", destination size: " + destinationSize + ", capacity needed: " + capacityNeeded);
}
}
public static /* synthetic */ byte[] decode$default(Base64 base64, byte[] bArr, int i, int i4, int i5, Object obj) {
if (obj != null) {
throw new UnsupportedOperationException("Super calls with default arguments not supported in this target, function: decode");
}
if ((i5 & 2) != 0) {
i = 0;
}
if ((i5 & 4) != 0) {
i4 = bArr.length;
}
return base64.decode(bArr, i, i4);
}
private final int decodeImpl(byte[] source, byte[] destination, int destinationOffset, int startIndex, int endIndex) {
int i;
int i4;
int[] access$getBase64UrlDecodeMap$p = this.isUrlSafe ? Base64Kt.access$getBase64UrlDecodeMap$p() : Base64Kt.access$getBase64DecodeMap$p();
int i5 = -8;
int i6 = destinationOffset;
int i7 = -8;
int i8 = 0;
int i9 = startIndex;
while (true) {
if (i9 >= endIndex) {
i = 8;
break;
}
if (i7 != i5 || i9 + 3 >= endIndex) {
i = 8;
i4 = 1;
} else {
i = 8;
int i10 = i9 + 4;
i4 = 1;
int i11 = (access$getBase64UrlDecodeMap$p[source[i9] & UByte.MAX_VALUE] << 18) | (access$getBase64UrlDecodeMap$p[source[i9 + 1] & UByte.MAX_VALUE] << 12) | (access$getBase64UrlDecodeMap$p[source[i9 + 2] & UByte.MAX_VALUE] << 6) | access$getBase64UrlDecodeMap$p[source[i9 + 3] & UByte.MAX_VALUE];
if (i11 >= 0) {
destination[i6] = (byte) (i11 >> 16);
int i12 = i6 + 2;
destination[i6 + 1] = (byte) (i11 >> 8);
i6 += 3;
destination[i12] = (byte) i11;
i9 = i10;
i5 = -8;
}
}
int i13 = source[i9] & UByte.MAX_VALUE;
int i14 = access$getBase64UrlDecodeMap$p[i13];
if (i14 >= 0) {
i9++;
i8 = (i8 << 6) | i14;
int i15 = i7 + 6;
if (i15 >= 0) {
destination[i6] = (byte) (i8 >>> i15);
i8 &= (i4 << i15) - 1;
i7 -= 2;
i6++;
} else {
i7 = i15;
}
} else {
if (i14 == -2) {
i9 = handlePaddingSymbol(source, i9, endIndex, i7);
break;
}
if (!this.isMimeScheme) {
StringBuilder sb = new StringBuilder("Invalid symbol '");
sb.append((char) i13);
sb.append("'(");
String num = Integer.toString(i13, CharsKt.checkRadix(i));
Intrinsics.checkNotNullExpressionValue(num, "toString(...)");
sb.append(num);
sb.append(") at index ");
sb.append(i9);
throw new IllegalArgumentException(sb.toString());
}
i9++;
}
i5 = -8;
}
if (i7 == -2) {
throw new IllegalArgumentException("The last unit of input does not have enough bits");
}
int skipIllegalSymbolsIfMime = skipIllegalSymbolsIfMime(source, i9, endIndex);
if (skipIllegalSymbolsIfMime >= endIndex) {
return i6 - destinationOffset;
}
int i16 = source[skipIllegalSymbolsIfMime] & UByte.MAX_VALUE;
StringBuilder sb2 = new StringBuilder("Symbol '");
sb2.append((char) i16);
sb2.append("'(");
String num2 = Integer.toString(i16, CharsKt.checkRadix(i));
Intrinsics.checkNotNullExpressionValue(num2, "toString(...)");
sb2.append(num2);
sb2.append(") at index ");
throw new IllegalArgumentException(a.m(sb2, skipIllegalSymbolsIfMime - 1, " is prohibited after the pad character"));
}
public static /* synthetic */ int decodeIntoByteArray$default(Base64 base64, byte[] bArr, byte[] bArr2, int i, int i4, int i5, int i6, Object obj) {
if (obj != null) {
throw new UnsupportedOperationException("Super calls with default arguments not supported in this target, function: decodeIntoByteArray");
}
if ((i6 & 4) != 0) {
i = 0;
}
if ((i6 & 8) != 0) {
i4 = 0;
}
if ((i6 & 16) != 0) {
i5 = bArr.length;
}
return base64.decodeIntoByteArray(bArr, bArr2, i, i4, i5);
}
private final int decodeSize(byte[] source, int startIndex, int endIndex) {
int i = endIndex - startIndex;
if (i == 0) {
return 0;
}
if (i == 1) {
throw new IllegalArgumentException(w.k("Input should have at list 2 symbols for Base64 decoding, startIndex: ", startIndex, endIndex, ", endIndex: "));
}
if (this.isMimeScheme) {
while (true) {
if (startIndex >= endIndex) {
break;
}
int i4 = Base64Kt.access$getBase64DecodeMap$p()[source[startIndex] & UByte.MAX_VALUE];
if (i4 < 0) {
if (i4 == -2) {
i -= endIndex - startIndex;
break;
}
i--;
}
startIndex++;
}
} else if (source[endIndex - 1] == 61) {
i = source[endIndex + (-2)] == 61 ? i - 2 : i - 1;
}
return (int) ((i * 6) / 8);
}
public static /* synthetic */ String encode$default(Base64 base64, byte[] bArr, int i, int i4, int i5, Object obj) {
if (obj != null) {
throw new UnsupportedOperationException("Super calls with default arguments not supported in this target, function: encode");
}
if ((i5 & 2) != 0) {
i = 0;
}
if ((i5 & 4) != 0) {
i4 = bArr.length;
}
return base64.encode(bArr, i, i4);
}
public static /* synthetic */ int encodeIntoByteArray$default(Base64 base64, byte[] bArr, byte[] bArr2, int i, int i4, int i5, int i6, Object obj) {
if (obj != null) {
throw new UnsupportedOperationException("Super calls with default arguments not supported in this target, function: encodeIntoByteArray");
}
if ((i6 & 4) != 0) {
i = 0;
}
if ((i6 & 8) != 0) {
i4 = 0;
}
if ((i6 & 16) != 0) {
i5 = bArr.length;
}
return base64.encodeIntoByteArray(bArr, bArr2, i, i4, i5);
}
private final int encodeSize(int sourceSize) {
int i = (sourceSize + 2) / 3;
int i4 = ((this.isMimeScheme ? (i - 1) / 19 : 0) * 2) + (i * 4);
if (i4 >= 0) {
return i4;
}
throw new IllegalArgumentException("Input is too big");
}
public static /* synthetic */ Appendable encodeToAppendable$default(Base64 base64, byte[] bArr, Appendable appendable, int i, int i4, int i5, Object obj) {
if (obj != null) {
throw new UnsupportedOperationException("Super calls with default arguments not supported in this target, function: encodeToAppendable");
}
if ((i5 & 4) != 0) {
i = 0;
}
if ((i5 & 8) != 0) {
i4 = bArr.length;
}
return base64.encodeToAppendable(bArr, appendable, i, i4);
}
public static /* synthetic */ byte[] encodeToByteArray$default(Base64 base64, byte[] bArr, int i, int i4, int i5, Object obj) {
if (obj != null) {
throw new UnsupportedOperationException("Super calls with default arguments not supported in this target, function: encodeToByteArray");
}
if ((i5 & 2) != 0) {
i = 0;
}
if ((i5 & 4) != 0) {
i4 = bArr.length;
}
return base64.encodeToByteArray(bArr, i, i4);
}
private final int handlePaddingSymbol(byte[] source, int padIndex, int endIndex, int byteStart) {
if (byteStart == -8) {
throw new IllegalArgumentException(a.l(padIndex, "Redundant pad character at index "));
}
if (byteStart == -6) {
return padIndex + 1;
}
if (byteStart != -4) {
if (byteStart == -2) {
return padIndex + 1;
}
throw new IllegalStateException("Unreachable");
}
int skipIllegalSymbolsIfMime = skipIllegalSymbolsIfMime(source, padIndex + 1, endIndex);
if (skipIllegalSymbolsIfMime == endIndex || source[skipIllegalSymbolsIfMime] != 61) {
throw new IllegalArgumentException(a.l(skipIllegalSymbolsIfMime, "Missing one pad character at index "));
}
return skipIllegalSymbolsIfMime + 1;
}
private final int skipIllegalSymbolsIfMime(byte[] source, int startIndex, int endIndex) {
if (!this.isMimeScheme) {
return startIndex;
}
while (startIndex < endIndex) {
if (Base64Kt.access$getBase64DecodeMap$p()[source[startIndex] & UByte.MAX_VALUE] != -1) {
break;
}
startIndex++;
}
return startIndex;
}
public final String bytesToStringImpl$kotlin_stdlib(byte[] source) {
Intrinsics.checkNotNullParameter(source, "source");
StringBuilder sb = new StringBuilder(source.length);
for (byte b4 : source) {
sb.append((char) b4);
}
String sb2 = sb.toString();
Intrinsics.checkNotNullExpressionValue(sb2, "toString(...)");
return sb2;
}
public final byte[] charsToBytesImpl$kotlin_stdlib(CharSequence source, int startIndex, int endIndex) {
Intrinsics.checkNotNullParameter(source, "source");
checkSourceBounds$kotlin_stdlib(source.length(), startIndex, endIndex);
byte[] bArr = new byte[endIndex - startIndex];
int i = 0;
while (startIndex < endIndex) {
char charAt = source.charAt(startIndex);
if (charAt <= 255) {
bArr[i] = (byte) charAt;
i++;
} else {
bArr[i] = 63;
i++;
}
startIndex++;
}
return bArr;
}
public final void checkSourceBounds$kotlin_stdlib(int sourceSize, int startIndex, int endIndex) {
AbstractList.INSTANCE.checkBoundsIndexes$kotlin_stdlib(startIndex, endIndex, sourceSize);
}
public final byte[] decode(byte[] source, int startIndex, int endIndex) {
Intrinsics.checkNotNullParameter(source, "source");
checkSourceBounds$kotlin_stdlib(source.length, startIndex, endIndex);
int decodeSize = decodeSize(source, startIndex, endIndex);
byte[] bArr = new byte[decodeSize];
if (decodeImpl(source, bArr, 0, startIndex, endIndex) == decodeSize) {
return bArr;
}
throw new IllegalStateException("Check failed.");
}
public final int decodeIntoByteArray(byte[] source, byte[] destination, int destinationOffset, int startIndex, int endIndex) {
Intrinsics.checkNotNullParameter(source, "source");
Intrinsics.checkNotNullParameter(destination, "destination");
checkSourceBounds$kotlin_stdlib(source.length, startIndex, endIndex);
checkDestinationBounds(destination.length, destinationOffset, decodeSize(source, startIndex, endIndex));
return decodeImpl(source, destination, destinationOffset, startIndex, endIndex);
}
public final String encode(byte[] source, int startIndex, int endIndex) {
Intrinsics.checkNotNullParameter(source, "source");
return new String(encodeToByteArrayImpl$kotlin_stdlib(source, startIndex, endIndex), Charsets.ISO_8859_1);
}
public final int encodeIntoByteArray(byte[] source, byte[] destination, int destinationOffset, int startIndex, int endIndex) {
Intrinsics.checkNotNullParameter(source, "source");
Intrinsics.checkNotNullParameter(destination, "destination");
return encodeIntoByteArrayImpl$kotlin_stdlib(source, destination, destinationOffset, startIndex, endIndex);
}
public final int encodeIntoByteArrayImpl$kotlin_stdlib(byte[] source, byte[] destination, int destinationOffset, int startIndex, int endIndex) {
Intrinsics.checkNotNullParameter(source, "source");
Intrinsics.checkNotNullParameter(destination, "destination");
checkSourceBounds$kotlin_stdlib(source.length, startIndex, endIndex);
checkDestinationBounds(destination.length, destinationOffset, encodeSize(endIndex - startIndex));
byte[] access$getBase64UrlEncodeMap$p = this.isUrlSafe ? Base64Kt.access$getBase64UrlEncodeMap$p() : Base64Kt.access$getBase64EncodeMap$p();
int i = this.isMimeScheme ? 19 : Integer.MAX_VALUE;
int i4 = destinationOffset;
while (startIndex + 2 < endIndex) {
int min = Math.min((endIndex - startIndex) / 3, i);
for (int i5 = 0; i5 < min; i5++) {
int i6 = source[startIndex] & UByte.MAX_VALUE;
int i7 = startIndex + 2;
int i8 = source[startIndex + 1] & UByte.MAX_VALUE;
startIndex += 3;
int i9 = (i8 << 8) | (i6 << 16) | (source[i7] & UByte.MAX_VALUE);
destination[i4] = access$getBase64UrlEncodeMap$p[i9 >>> 18];
destination[i4 + 1] = access$getBase64UrlEncodeMap$p[(i9 >>> 12) & 63];
int i10 = i4 + 3;
destination[i4 + 2] = access$getBase64UrlEncodeMap$p[(i9 >>> 6) & 63];
i4 += 4;
destination[i10] = access$getBase64UrlEncodeMap$p[i9 & 63];
}
if (min == i && startIndex != endIndex) {
int i11 = i4 + 1;
byte[] bArr = mimeLineSeparatorSymbols;
destination[i4] = bArr[0];
i4 += 2;
destination[i11] = bArr[1];
}
}
int i12 = endIndex - startIndex;
if (i12 == 1) {
int i13 = (source[startIndex] & UByte.MAX_VALUE) << 4;
destination[i4] = access$getBase64UrlEncodeMap$p[i13 >>> 6];
destination[i4 + 1] = access$getBase64UrlEncodeMap$p[i13 & 63];
int i14 = i4 + 3;
destination[i4 + 2] = padSymbol;
i4 += 4;
destination[i14] = padSymbol;
startIndex++;
} else if (i12 == 2) {
int i15 = startIndex + 1;
int i16 = source[startIndex] & UByte.MAX_VALUE;
startIndex += 2;
int i17 = ((source[i15] & UByte.MAX_VALUE) << 2) | (i16 << 10);
destination[i4] = access$getBase64UrlEncodeMap$p[i17 >>> 12];
destination[i4 + 1] = access$getBase64UrlEncodeMap$p[(i17 >>> 6) & 63];
int i18 = i4 + 3;
destination[i4 + 2] = access$getBase64UrlEncodeMap$p[i17 & 63];
i4 += 4;
destination[i18] = padSymbol;
}
if (startIndex == endIndex) {
return i4 - destinationOffset;
}
throw new IllegalStateException("Check failed.");
}
public final <A extends Appendable> A encodeToAppendable(byte[] source, A destination, int startIndex, int endIndex) {
Intrinsics.checkNotNullParameter(source, "source");
Intrinsics.checkNotNullParameter(destination, "destination");
destination.append(new String(encodeToByteArrayImpl$kotlin_stdlib(source, startIndex, endIndex), Charsets.ISO_8859_1));
return destination;
}
public final byte[] encodeToByteArray(byte[] source, int startIndex, int endIndex) {
Intrinsics.checkNotNullParameter(source, "source");
return encodeToByteArrayImpl$kotlin_stdlib(source, startIndex, endIndex);
}
public final byte[] encodeToByteArrayImpl$kotlin_stdlib(byte[] source, int startIndex, int endIndex) {
Intrinsics.checkNotNullParameter(source, "source");
checkSourceBounds$kotlin_stdlib(source.length, startIndex, endIndex);
byte[] bArr = new byte[encodeSize(endIndex - startIndex)];
encodeIntoByteArrayImpl$kotlin_stdlib(source, bArr, 0, startIndex, endIndex);
return bArr;
}
/* renamed from: isMimeScheme$kotlin_stdlib, reason: from getter */
public final boolean getIsMimeScheme() {
return this.isMimeScheme;
}
/* renamed from: isUrlSafe$kotlin_stdlib, reason: from getter */
public final boolean getIsUrlSafe() {
return this.isUrlSafe;
}
private Base64(boolean z3, boolean z4) {
this.isUrlSafe = z3;
this.isMimeScheme = z4;
if (z3 && z4) {
throw new IllegalArgumentException("Failed requirement.");
}
}
public static /* synthetic */ byte[] decode$default(Base64 base64, CharSequence charSequence, int i, int i4, int i5, Object obj) {
if (obj != null) {
throw new UnsupportedOperationException("Super calls with default arguments not supported in this target, function: decode");
}
if ((i5 & 2) != 0) {
i = 0;
}
if ((i5 & 4) != 0) {
i4 = charSequence.length();
}
return base64.decode(charSequence, i, i4);
}
public static /* synthetic */ int decodeIntoByteArray$default(Base64 base64, CharSequence charSequence, byte[] bArr, int i, int i4, int i5, int i6, Object obj) {
if (obj != null) {
throw new UnsupportedOperationException("Super calls with default arguments not supported in this target, function: decodeIntoByteArray");
}
if ((i6 & 4) != 0) {
i = 0;
}
if ((i6 & 8) != 0) {
i4 = 0;
}
if ((i6 & 16) != 0) {
i5 = charSequence.length();
}
return base64.decodeIntoByteArray(charSequence, bArr, i, i4, i5);
}
public final int decodeIntoByteArray(CharSequence source, byte[] destination, int destinationOffset, int startIndex, int endIndex) {
byte[] charsToBytesImpl$kotlin_stdlib;
Intrinsics.checkNotNullParameter(source, "source");
Intrinsics.checkNotNullParameter(destination, "destination");
if (source instanceof String) {
checkSourceBounds$kotlin_stdlib(((String) source).length(), startIndex, endIndex);
String substring = ((String) source).substring(startIndex, endIndex);
Intrinsics.checkNotNullExpressionValue(substring, "substring(...)");
Charset charset = Charsets.ISO_8859_1;
Intrinsics.checkNotNull(substring, "null cannot be cast to non-null type java.lang.String");
charsToBytesImpl$kotlin_stdlib = substring.getBytes(charset);
Intrinsics.checkNotNullExpressionValue(charsToBytesImpl$kotlin_stdlib, "getBytes(...)");
} else {
charsToBytesImpl$kotlin_stdlib = charsToBytesImpl$kotlin_stdlib(source, startIndex, endIndex);
}
return decodeIntoByteArray$default(this, charsToBytesImpl$kotlin_stdlib, destination, destinationOffset, 0, 0, 24, (Object) null);
}
public final byte[] decode(CharSequence source, int startIndex, int endIndex) {
byte[] charsToBytesImpl$kotlin_stdlib;
Intrinsics.checkNotNullParameter(source, "source");
if (source instanceof String) {
checkSourceBounds$kotlin_stdlib(((String) source).length(), startIndex, endIndex);
String substring = ((String) source).substring(startIndex, endIndex);
Intrinsics.checkNotNullExpressionValue(substring, "substring(...)");
Charset charset = Charsets.ISO_8859_1;
Intrinsics.checkNotNull(substring, "null cannot be cast to non-null type java.lang.String");
charsToBytesImpl$kotlin_stdlib = substring.getBytes(charset);
Intrinsics.checkNotNullExpressionValue(charsToBytesImpl$kotlin_stdlib, "getBytes(...)");
} else {
charsToBytesImpl$kotlin_stdlib = charsToBytesImpl$kotlin_stdlib(source, startIndex, endIndex);
}
return decode$default(this, charsToBytesImpl$kotlin_stdlib, 0, 0, 6, (Object) null);
}
}

View File

@@ -0,0 +1,60 @@
package kotlin.io.encoding;
import com.google.firebase.analytics.FirebaseAnalytics;
import java.nio.charset.Charset;
import kotlin.Metadata;
import kotlin.SinceKotlin;
import kotlin.internal.InlineOnly;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.Charsets;
@Metadata(d1 = {"\u0000 \n\u0000\n\u0002\u0010\u0012\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\r\n\u0000\n\u0002\u0010\b\n\u0002\b\u0006\n\u0002\u0010\u000e\n\u0000\u001a%\u0010\u0000\u001a\u00020\u0001*\u00020\u00022\u0006\u0010\u0003\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u00062\u0006\u0010\u0007\u001a\u00020\u0006H\u0081\b\u001a5\u0010\b\u001a\u00020\u0006*\u00020\u00022\u0006\u0010\u0003\u001a\u00020\u00012\u0006\u0010\t\u001a\u00020\u00012\u0006\u0010\n\u001a\u00020\u00062\u0006\u0010\u0005\u001a\u00020\u00062\u0006\u0010\u0007\u001a\u00020\u0006H\u0081\b\u001a%\u0010\u000b\u001a\u00020\u0001*\u00020\u00022\u0006\u0010\u0003\u001a\u00020\u00012\u0006\u0010\u0005\u001a\u00020\u00062\u0006\u0010\u0007\u001a\u00020\u0006H\u0081\b\u001a%\u0010\f\u001a\u00020\r*\u00020\u00022\u0006\u0010\u0003\u001a\u00020\u00012\u0006\u0010\u0005\u001a\u00020\u00062\u0006\u0010\u0007\u001a\u00020\u0006H\u0081\\u0006\u000e"}, d2 = {"platformCharsToBytes", "", "Lkotlin/io/encoding/Base64;", "source", "", "startIndex", "", "endIndex", "platformEncodeIntoByteArray", FirebaseAnalytics.Param.DESTINATION, "destinationOffset", "platformEncodeToByteArray", "platformEncodeToString", "", "kotlin-stdlib"}, k = 2, mv = {1, 9, 0}, xi = 48)
/* loaded from: classes3.dex */
public final class Base64JVMKt {
@ExperimentalEncodingApi
@SinceKotlin(version = "1.8")
@InlineOnly
private static final byte[] platformCharsToBytes(Base64 base64, CharSequence source, int i, int i4) {
Intrinsics.checkNotNullParameter(base64, "<this>");
Intrinsics.checkNotNullParameter(source, "source");
if (!(source instanceof String)) {
return base64.charsToBytesImpl$kotlin_stdlib(source, i, i4);
}
base64.checkSourceBounds$kotlin_stdlib(((String) source).length(), i, i4);
String substring = ((String) source).substring(i, i4);
Intrinsics.checkNotNullExpressionValue(substring, "substring(...)");
Charset charset = Charsets.ISO_8859_1;
Intrinsics.checkNotNull(substring, "null cannot be cast to non-null type java.lang.String");
byte[] bytes = substring.getBytes(charset);
Intrinsics.checkNotNullExpressionValue(bytes, "getBytes(...)");
return bytes;
}
@ExperimentalEncodingApi
@SinceKotlin(version = "1.8")
@InlineOnly
private static final int platformEncodeIntoByteArray(Base64 base64, byte[] source, byte[] destination, int i, int i4, int i5) {
Intrinsics.checkNotNullParameter(base64, "<this>");
Intrinsics.checkNotNullParameter(source, "source");
Intrinsics.checkNotNullParameter(destination, "destination");
return base64.encodeIntoByteArrayImpl$kotlin_stdlib(source, destination, i, i4, i5);
}
@ExperimentalEncodingApi
@SinceKotlin(version = "1.8")
@InlineOnly
private static final byte[] platformEncodeToByteArray(Base64 base64, byte[] source, int i, int i4) {
Intrinsics.checkNotNullParameter(base64, "<this>");
Intrinsics.checkNotNullParameter(source, "source");
return base64.encodeToByteArrayImpl$kotlin_stdlib(source, i, i4);
}
@ExperimentalEncodingApi
@SinceKotlin(version = "1.8")
@InlineOnly
private static final String platformEncodeToString(Base64 base64, byte[] source, int i, int i4) {
Intrinsics.checkNotNullParameter(base64, "<this>");
Intrinsics.checkNotNullParameter(source, "source");
return new String(base64.encodeToByteArrayImpl$kotlin_stdlib(source, i, i4), Charsets.ISO_8859_1);
}
}

View File

@@ -0,0 +1,79 @@
package kotlin.io.encoding;
import kotlin.Metadata;
import kotlin.SinceKotlin;
import kotlin.collections.ArraysKt___ArraysJvmKt;
import kotlin.jvm.internal.SourceDebugExtension;
@Metadata(d1 = {"\u0000\u001e\n\u0000\n\u0002\u0010\u0015\n\u0002\b\u0003\n\u0002\u0010\u0012\n\u0002\b\u0004\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\b\n\u0000\u001a\u0010\u0010\t\u001a\u00020\n2\u0006\u0010\u000b\u001a\u00020\fH\u0001\"\u0016\u0010\u0000\u001a\u00020\u00018\u0002X\u0083\u0004¢\u0006\b\n\u0000\u0012\u0004\b\u0002\u0010\u0003\"\u000e\u0010\u0004\u001a\u00020\u0005X\u0082\u0004¢\u0006\u0002\n\u0000\"\u0016\u0010\u0006\u001a\u00020\u00018\u0002X\u0083\u0004¢\u0006\b\n\u0000\u0012\u0004\b\u0007\u0010\u0003\"\u000e\u0010\b\u001a\u00020\u0005X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\r"}, d2 = {"base64DecodeMap", "", "getBase64DecodeMap$annotations", "()V", "base64EncodeMap", "", "base64UrlDecodeMap", "getBase64UrlDecodeMap$annotations", "base64UrlEncodeMap", "isInMimeAlphabet", "", "symbol", "", "kotlin-stdlib"}, k = 2, mv = {1, 9, 0}, xi = 48)
@SourceDebugExtension({"SMAP\nBase64.kt\nKotlin\n*S Kotlin\n*F\n+ 1 Base64.kt\nkotlin/io/encoding/Base64Kt\n+ 2 _Arrays.kt\nkotlin/collections/ArraysKt___ArraysKt\n*L\n1#1,643:1\n13384#2,3:644\n13384#2,3:647\n*S KotlinDebug\n*F\n+ 1 Base64.kt\nkotlin/io/encoding/Base64Kt\n*L\n580#1:644,3\n597#1:647,3\n*E\n"})
/* loaded from: classes3.dex */
public final class Base64Kt {
private static final int[] base64DecodeMap;
private static final byte[] base64EncodeMap;
private static final int[] base64UrlDecodeMap;
private static final byte[] base64UrlEncodeMap;
static {
byte[] bArr = {65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47};
base64EncodeMap = bArr;
int[] iArr = new int[256];
ArraysKt___ArraysJvmKt.fill$default(iArr, -1, 0, 0, 6, (Object) null);
iArr[61] = -2;
int i = 0;
int i4 = 0;
int i5 = 0;
while (i4 < 64) {
iArr[bArr[i4]] = i5;
i4++;
i5++;
}
base64DecodeMap = iArr;
byte[] bArr2 = {65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 45, 95};
base64UrlEncodeMap = bArr2;
int[] iArr2 = new int[256];
ArraysKt___ArraysJvmKt.fill$default(iArr2, -1, 0, 0, 6, (Object) null);
iArr2[61] = -2;
int i6 = 0;
while (i < 64) {
iArr2[bArr2[i]] = i6;
i++;
i6++;
}
base64UrlDecodeMap = iArr2;
}
public static final /* synthetic */ int[] access$getBase64DecodeMap$p() {
return base64DecodeMap;
}
public static final /* synthetic */ byte[] access$getBase64EncodeMap$p() {
return base64EncodeMap;
}
public static final /* synthetic */ int[] access$getBase64UrlDecodeMap$p() {
return base64UrlDecodeMap;
}
public static final /* synthetic */ byte[] access$getBase64UrlEncodeMap$p() {
return base64UrlEncodeMap;
}
@ExperimentalEncodingApi
private static /* synthetic */ void getBase64DecodeMap$annotations() {
}
@ExperimentalEncodingApi
private static /* synthetic */ void getBase64UrlDecodeMap$annotations() {
}
@ExperimentalEncodingApi
@SinceKotlin(version = "1.8")
public static final boolean isInMimeAlphabet(int i) {
if (i < 0) {
return false;
}
int[] iArr = base64DecodeMap;
return i < iArr.length && iArr[i] != -1;
}
}

View File

@@ -0,0 +1,186 @@
package kotlin.io.encoding;
import com.google.firebase.analytics.FirebaseAnalytics;
import java.io.IOException;
import java.io.InputStream;
import kotlin.Metadata;
import kotlin.UByte;
import kotlin.collections.ArraysKt;
import kotlin.jvm.internal.Intrinsics;
@ExperimentalEncodingApi
@Metadata(d1 = {"\u00002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0012\n\u0000\n\u0002\u0010\b\n\u0002\b\u0005\n\u0002\u0010\u000b\n\u0002\b\u0004\n\u0002\u0010\u0002\n\u0002\b\u000f\b\u0003\u0018\u00002\u00020\u0001B\u0015\u0012\u0006\u0010\u0002\u001a\u00020\u0001\u0012\u0006\u0010\u0003\u001a\u00020\u0004¢\u0006\u0002\u0010\u0005J\b\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\b\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\b\u0010 \u001a\u00020\tH\u0002J\b\u0010!\u001a\u00020\u0014H\u0002J\b\u0010\"\u001a\u00020\u0014H\u0002R\u000e\u0010\u0003\u001a\u00020\u0004X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0006\u001a\u00020\u0007X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\b\u001a\u00020\tX\u0082\u000e¢\u0006\u0002\n\u0000R\u0014\u0010\n\u001a\u00020\t8BX\u0082\u0004¢\u0006\u0006\u001a\u0004\b\u000b\u0010\fR\u000e\u0010\r\u001a\u00020\tX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0002\u001a\u00020\u0001X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u000e\u001a\u00020\u000fX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0010\u001a\u00020\u000fX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0011\u001a\u00020\u0007X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0012\u001a\u00020\u0007X\u0082\u0004¢\u0006\u0002\n\u0000¨\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", FirebaseAnalytics.Param.DESTINATION, "offset", "readNextSymbol", "resetByteBufferIfEmpty", "shiftByteBufferToStartIfNeeded", "kotlin-stdlib"}, k = 1, mv = {1, 9, 0}, xi = 48)
/* loaded from: classes3.dex */
final class DecodeInputStream extends InputStream {
private final Base64 base64;
private final byte[] byteBuffer;
private int byteBufferEndIndex;
private int byteBufferStartIndex;
private final InputStream input;
private boolean isClosed;
private boolean isEOF;
private final byte[] singleByteBuffer;
private final byte[] symbolBuffer;
public DecodeInputStream(InputStream input, Base64 base64) {
Intrinsics.checkNotNullParameter(input, "input");
Intrinsics.checkNotNullParameter(base64, "base64");
this.input = input;
this.base64 = base64;
this.singleByteBuffer = new byte[1];
this.symbolBuffer = new byte[1024];
this.byteBuffer = new byte[1024];
}
private final void copyByteBufferInto(byte[] dst, int dstOffset, int length) {
byte[] bArr = this.byteBuffer;
int i = this.byteBufferStartIndex;
ArraysKt.copyInto(bArr, dst, dstOffset, i, i + length);
this.byteBufferStartIndex += length;
resetByteBufferIfEmpty();
}
private final int decodeSymbolBufferInto(byte[] dst, int dstOffset, int dstEndIndex, int symbolBufferLength) {
int i = this.byteBufferEndIndex;
this.byteBufferEndIndex = i + this.base64.decodeIntoByteArray(this.symbolBuffer, this.byteBuffer, i, 0, symbolBufferLength);
int min = Math.min(getByteBufferLength(), dstEndIndex - dstOffset);
copyByteBufferInto(dst, dstOffset, min);
shiftByteBufferToStartIfNeeded();
return min;
}
private final int getByteBufferLength() {
return this.byteBufferEndIndex - this.byteBufferStartIndex;
}
private final int handlePaddingSymbol(int symbolBufferLength) {
this.symbolBuffer[symbolBufferLength] = Base64.padSymbol;
if ((symbolBufferLength & 3) != 2) {
return symbolBufferLength + 1;
}
int readNextSymbol = readNextSymbol();
if (readNextSymbol >= 0) {
this.symbolBuffer[symbolBufferLength + 1] = (byte) readNextSymbol;
}
return symbolBufferLength + 2;
}
private final int readNextSymbol() {
int read;
if (!this.base64.getIsMimeScheme()) {
return this.input.read();
}
do {
read = this.input.read();
if (read == -1) {
break;
}
} while (!Base64Kt.isInMimeAlphabet(read));
return read;
}
private final void resetByteBufferIfEmpty() {
if (this.byteBufferStartIndex == this.byteBufferEndIndex) {
this.byteBufferStartIndex = 0;
this.byteBufferEndIndex = 0;
}
}
private final void shiftByteBufferToStartIfNeeded() {
byte[] bArr = this.byteBuffer;
int length = bArr.length;
int i = this.byteBufferEndIndex;
if ((this.symbolBuffer.length / 4) * 3 > length - i) {
ArraysKt.copyInto(bArr, bArr, 0, this.byteBufferStartIndex, i);
this.byteBufferEndIndex -= this.byteBufferStartIndex;
this.byteBufferStartIndex = 0;
}
}
@Override // java.io.InputStream, java.io.Closeable, java.lang.AutoCloseable
public void close() {
if (this.isClosed) {
return;
}
this.isClosed = true;
this.input.close();
}
@Override // java.io.InputStream
public int read() {
int i = this.byteBufferStartIndex;
if (i < this.byteBufferEndIndex) {
int i4 = this.byteBuffer[i] & UByte.MAX_VALUE;
this.byteBufferStartIndex = i + 1;
resetByteBufferIfEmpty();
return i4;
}
int read = read(this.singleByteBuffer, 0, 1);
if (read == -1) {
return -1;
}
if (read == 1) {
return this.singleByteBuffer[0] & UByte.MAX_VALUE;
}
throw new IllegalStateException("Unreachable");
}
@Override // java.io.InputStream
public int read(byte[] destination, int offset, int length) {
int i;
boolean z3;
boolean z4;
Intrinsics.checkNotNullParameter(destination, "destination");
if (offset >= 0 && length >= 0 && (i = offset + length) <= destination.length) {
if (!this.isClosed) {
if (this.isEOF) {
return -1;
}
if (length == 0) {
return 0;
}
if (getByteBufferLength() >= length) {
copyByteBufferInto(destination, offset, length);
return length;
}
int byteBufferLength = (((length - getByteBufferLength()) + 2) / 3) * 4;
int i4 = offset;
while (true) {
z3 = this.isEOF;
if (z3 || byteBufferLength <= 0) {
break;
}
int min = Math.min(this.symbolBuffer.length, byteBufferLength);
int i5 = 0;
while (true) {
z4 = this.isEOF;
if (z4 || i5 >= min) {
break;
}
int readNextSymbol = readNextSymbol();
if (readNextSymbol == -1) {
this.isEOF = true;
} else if (readNextSymbol != 61) {
this.symbolBuffer[i5] = (byte) readNextSymbol;
i5++;
} else {
i5 = handlePaddingSymbol(i5);
this.isEOF = true;
}
}
if (!z4 && i5 != min) {
throw new IllegalStateException("Check failed.");
}
byteBufferLength -= i5;
i4 += decodeSymbolBufferInto(destination, i4, i, i5);
}
if (i4 == offset && z3) {
return -1;
}
return i4 - offset;
}
throw new IOException("The input stream is closed.");
}
throw new IndexOutOfBoundsException("offset: " + offset + ", length: " + length + ", buffer size: " + destination.length);
}
}

View File

@@ -0,0 +1,133 @@
package kotlin.io.encoding;
import java.io.IOException;
import java.io.OutputStream;
import kotlin.Metadata;
import kotlin.collections.ArraysKt;
import kotlin.jvm.internal.Intrinsics;
@ExperimentalEncodingApi
@Metadata(d1 = {"\u00000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0012\n\u0000\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0003\n\u0002\u0010\u0002\n\u0002\b\r\b\u0003\u0018\u00002\u00020\u0001B\u0015\u0012\u0006\u0010\u0002\u001a\u00020\u0001\u0012\u0006\u0010\u0003\u001a\u00020\u0004¢\u0006\u0002\u0010\u0005J\b\u0010\u000e\u001a\u00020\u000fH\u0002J\b\u0010\u0010\u001a\u00020\u000fH\u0016J \u0010\u0011\u001a\u00020\t2\u0006\u0010\u0012\u001a\u00020\u00072\u0006\u0010\u0013\u001a\u00020\t2\u0006\u0010\u0014\u001a\u00020\tH\u0002J\b\u0010\u0015\u001a\u00020\u000fH\u0002J \u0010\u0016\u001a\u00020\t2\u0006\u0010\u0012\u001a\u00020\u00072\u0006\u0010\u0013\u001a\u00020\t2\u0006\u0010\u0014\u001a\u00020\tH\u0002J\b\u0010\u0017\u001a\u00020\u000fH\u0016J \u0010\u0018\u001a\u00020\u000f2\u0006\u0010\u0012\u001a\u00020\u00072\u0006\u0010\u0019\u001a\u00020\t2\u0006\u0010\u001a\u001a\u00020\tH\u0016J\u0010\u0010\u0018\u001a\u00020\u000f2\u0006\u0010\u001b\u001a\u00020\tH\u0016R\u000e\u0010\u0003\u001a\u00020\u0004X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0006\u001a\u00020\u0007X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\b\u001a\u00020\tX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\n\u001a\u00020\u000bX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\f\u001a\u00020\tX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0002\u001a\u00020\u0001X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\r\u001a\u00020\u0007X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u001c"}, d2 = {"Lkotlin/io/encoding/EncodeOutputStream;", "Ljava/io/OutputStream;", "output", "base64", "Lkotlin/io/encoding/Base64;", "(Ljava/io/OutputStream;Lkotlin/io/encoding/Base64;)V", "byteBuffer", "", "byteBufferLength", "", "isClosed", "", "lineLength", "symbolBuffer", "checkOpen", "", "close", "copyIntoByteBuffer", "source", "startIndex", "endIndex", "encodeByteBufferIntoOutput", "encodeIntoOutput", "flush", "write", "offset", "length", "b", "kotlin-stdlib"}, k = 1, mv = {1, 9, 0}, xi = 48)
/* loaded from: classes3.dex */
final class EncodeOutputStream extends OutputStream {
private final Base64 base64;
private final byte[] byteBuffer;
private int byteBufferLength;
private boolean isClosed;
private int lineLength;
private final OutputStream output;
private final byte[] symbolBuffer;
public EncodeOutputStream(OutputStream output, Base64 base64) {
Intrinsics.checkNotNullParameter(output, "output");
Intrinsics.checkNotNullParameter(base64, "base64");
this.output = output;
this.base64 = base64;
this.lineLength = base64.getIsMimeScheme() ? 76 : -1;
this.symbolBuffer = new byte[1024];
this.byteBuffer = new byte[3];
}
private final void checkOpen() {
if (this.isClosed) {
throw new IOException("The output stream is closed.");
}
}
private final int copyIntoByteBuffer(byte[] source, int startIndex, int endIndex) {
int min = Math.min(3 - this.byteBufferLength, endIndex - startIndex);
ArraysKt.copyInto(source, this.byteBuffer, this.byteBufferLength, startIndex, startIndex + min);
int i = this.byteBufferLength + min;
this.byteBufferLength = i;
if (i == 3) {
encodeByteBufferIntoOutput();
}
return min;
}
private final void encodeByteBufferIntoOutput() {
if (encodeIntoOutput(this.byteBuffer, 0, this.byteBufferLength) != 4) {
throw new IllegalStateException("Check failed.");
}
this.byteBufferLength = 0;
}
private final int encodeIntoOutput(byte[] source, int startIndex, int endIndex) {
int encodeIntoByteArray = this.base64.encodeIntoByteArray(source, this.symbolBuffer, 0, startIndex, endIndex);
if (this.lineLength == 0) {
this.output.write(Base64.INSTANCE.getMimeLineSeparatorSymbols$kotlin_stdlib());
this.lineLength = 76;
if (encodeIntoByteArray > 76) {
throw new IllegalStateException("Check failed.");
}
}
this.output.write(this.symbolBuffer, 0, encodeIntoByteArray);
this.lineLength -= encodeIntoByteArray;
return encodeIntoByteArray;
}
@Override // java.io.OutputStream, java.io.Closeable, java.lang.AutoCloseable
public void close() {
if (this.isClosed) {
return;
}
this.isClosed = true;
if (this.byteBufferLength != 0) {
encodeByteBufferIntoOutput();
}
this.output.close();
}
@Override // java.io.OutputStream, java.io.Flushable
public void flush() {
checkOpen();
this.output.flush();
}
@Override // java.io.OutputStream
public void write(int b4) {
checkOpen();
byte[] bArr = this.byteBuffer;
int i = this.byteBufferLength;
int i4 = i + 1;
this.byteBufferLength = i4;
bArr[i] = (byte) b4;
if (i4 == 3) {
encodeByteBufferIntoOutput();
}
}
@Override // java.io.OutputStream
public void write(byte[] source, int offset, int length) {
int i;
Intrinsics.checkNotNullParameter(source, "source");
checkOpen();
if (offset < 0 || length < 0 || (i = offset + length) > source.length) {
throw new IndexOutOfBoundsException("offset: " + offset + ", length: " + length + ", source size: " + source.length);
}
if (length == 0) {
return;
}
int i4 = this.byteBufferLength;
if (i4 < 3) {
if (i4 != 0) {
offset += copyIntoByteBuffer(source, offset, i);
if (this.byteBufferLength != 0) {
return;
}
}
while (offset + 3 <= i) {
int min = Math.min((this.base64.getIsMimeScheme() ? this.lineLength : this.symbolBuffer.length) / 4, (i - offset) / 3);
int i5 = (min * 3) + offset;
if (encodeIntoOutput(source, offset, i5) != min * 4) {
throw new IllegalStateException("Check failed.");
}
offset = i5;
}
ArraysKt.copyInto(source, this.byteBuffer, 0, offset, i);
this.byteBufferLength = i - offset;
return;
}
throw new IllegalStateException("Check failed.");
}
}

View File

@@ -0,0 +1,26 @@
package kotlin.io.encoding;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import kotlin.Metadata;
import kotlin.RequiresOptIn;
import kotlin.SinceKotlin;
import kotlin.annotation.AnnotationRetention;
import kotlin.annotation.AnnotationTarget;
import kotlin.annotation.MustBeDocumented;
@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER, ElementType.CONSTRUCTOR, ElementType.LOCAL_VARIABLE, ElementType.ANNOTATION_TYPE})
@SinceKotlin(version = "1.8")
@RequiresOptIn(level = RequiresOptIn.Level.ERROR)
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.CLASS, AnnotationTarget.ANNOTATION_CLASS, AnnotationTarget.PROPERTY, AnnotationTarget.FIELD, AnnotationTarget.LOCAL_VARIABLE, AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.CONSTRUCTOR, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.TYPEALIAS})
@Retention(RetentionPolicy.CLASS)
@kotlin.annotation.Retention(AnnotationRetention.BINARY)
@MustBeDocumented
@Metadata(d1 = {"\u0000\n\n\u0002\u0018\u0002\n\u0002\u0010\u001b\n\u0000\b\u0087\u0002\u0018\u00002\u00020\u0001B\u0000¨\u0006\u0002"}, d2 = {"Lkotlin/io/encoding/ExperimentalEncodingApi;", "", "kotlin-stdlib"}, k = 1, mv = {1, 9, 0}, xi = 48)
@Documented
/* loaded from: classes3.dex */
public @interface ExperimentalEncodingApi {
}

View File

@@ -0,0 +1,10 @@
package kotlin.io.encoding;
import kotlin.Metadata;
@Metadata(d1 = {"kotlin/io/encoding/StreamEncodingKt__Base64IOStreamKt"}, k = 4, mv = {1, 9, 0}, xi = 49)
/* loaded from: classes3.dex */
public final class StreamEncodingKt extends StreamEncodingKt__Base64IOStreamKt {
private StreamEncodingKt() {
}
}

View File

@@ -0,0 +1,27 @@
package kotlin.io.encoding;
import java.io.InputStream;
import java.io.OutputStream;
import kotlin.Metadata;
import kotlin.SinceKotlin;
import kotlin.jvm.internal.Intrinsics;
@Metadata(d1 = {"\u0000\u0014\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\u001a\u0014\u0010\u0000\u001a\u00020\u0001*\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u0003H\u0007\u001a\u0014\u0010\u0004\u001a\u00020\u0005*\u00020\u00052\u0006\u0010\u0002\u001a\u00020\u0003H\u0007¨\u0006\u0006"}, d2 = {"decodingWith", "Ljava/io/InputStream;", "base64", "Lkotlin/io/encoding/Base64;", "encodingWith", "Ljava/io/OutputStream;", "kotlin-stdlib"}, k = 5, mv = {1, 9, 0}, xi = 49, xs = "kotlin/io/encoding/StreamEncodingKt")
/* loaded from: classes3.dex */
class StreamEncodingKt__Base64IOStreamKt {
@ExperimentalEncodingApi
@SinceKotlin(version = "1.8")
public static final InputStream decodingWith(InputStream inputStream, Base64 base64) {
Intrinsics.checkNotNullParameter(inputStream, "<this>");
Intrinsics.checkNotNullParameter(base64, "base64");
return new DecodeInputStream(inputStream, base64);
}
@ExperimentalEncodingApi
@SinceKotlin(version = "1.8")
public static final OutputStream encodingWith(OutputStream outputStream, Base64 base64) {
Intrinsics.checkNotNullParameter(outputStream, "<this>");
Intrinsics.checkNotNullParameter(base64, "base64");
return new EncodeOutputStream(outputStream, base64);
}
}