alexandroid/decompiled/jadx/sources/androidx/emoji2/text/flatbuffer/Utf8.java
KaKi87 a47fad5135 📦 Add decompiled Alexa 2.2.730155.0 (jadx, apktool, Hermes strings)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-07 00:04:16 +01:00

100 lines
3.8 KiB
Java

package androidx.emoji2.text.flatbuffer;
import defpackage.a$$ExternalSyntheticOutline0;
import java.nio.ByteBuffer;
import rx.Single$$ExternalSyntheticBUOutline0;
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
/* loaded from: classes14.dex */
public abstract class Utf8 {
private static Utf8 DEFAULT;
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
public static class DecodeUtil {
public static void handleFourBytes(byte b, byte b2, byte b3, byte b4, char[] cArr, int i) throws IllegalArgumentException {
if (!isNotTrailingByte(b2)) {
if ((((b2 + 112) + (b << 28)) >> 30) == 0 && !isNotTrailingByte(b3) && !isNotTrailingByte(b4)) {
int trailingByteValue = ((b & 7) << 18) | (trailingByteValue(b2) << 12) | (trailingByteValue(b3) << 6) | trailingByteValue(b4);
cArr[i] = highSurrogate(trailingByteValue);
cArr[i + 1] = lowSurrogate(trailingByteValue);
return;
}
}
Single$$ExternalSyntheticBUOutline0.m$3("Invalid UTF-8");
}
public static void handleOneByte(byte b, char[] cArr, int i) {
cArr[i] = (char) b;
}
public static void handleThreeBytes(byte b, byte b2, byte b3, char[] cArr, int i) throws IllegalArgumentException {
if (isNotTrailingByte(b2) || ((b == -32 && b2 < -96) || ((b == -19 && b2 >= -96) || isNotTrailingByte(b3)))) {
Single$$ExternalSyntheticBUOutline0.m$3("Invalid UTF-8");
} else {
cArr[i] = (char) (((b & 15) << 12) | (trailingByteValue(b2) << 6) | trailingByteValue(b3));
}
}
public static void handleTwoBytes(byte b, byte b2, char[] cArr, int i) throws IllegalArgumentException {
if (b < -62) {
Single$$ExternalSyntheticBUOutline0.m$3("Invalid UTF-8: Illegal leading byte in 2 bytes utf");
} else if (isNotTrailingByte(b2)) {
Single$$ExternalSyntheticBUOutline0.m$3("Invalid UTF-8: Illegal trailing byte in 2 bytes utf");
} else {
cArr[i] = (char) (((b & 31) << 6) | trailingByteValue(b2));
}
}
private static char highSurrogate(int i) {
return (char) ((i >>> 10) + okio.Utf8.HIGH_SURROGATE_HEADER);
}
private static boolean isNotTrailingByte(byte b) {
return b > -65;
}
public static boolean isOneByte(byte b) {
return b >= 0;
}
public static boolean isThreeBytes(byte b) {
return b < -16;
}
public static boolean isTwoBytes(byte b) {
return b < -32;
}
private static char lowSurrogate(int i) {
return (char) ((i & 1023) + 56320);
}
private static int trailingByteValue(byte b) {
return b & okio.Utf8.REPLACEMENT_BYTE;
}
}
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
public static class UnpairedSurrogateException extends IllegalArgumentException {
public UnpairedSurrogateException(int i, int i2) {
super(a$$ExternalSyntheticOutline0.m("Unpaired surrogate at index ", i, " of ", i2));
}
}
public static Utf8 getDefault() {
if (DEFAULT == null) {
DEFAULT = new Utf8Safe();
}
return DEFAULT;
}
public static void setDefault(Utf8 utf8) {
DEFAULT = utf8;
}
public abstract String decodeUtf8(ByteBuffer byteBuffer, int i, int i2);
public abstract void encodeUtf8(CharSequence charSequence, ByteBuffer byteBuffer);
public abstract int encodedLength(CharSequence charSequence);
}