Files
Daniel Elliott c080f0d97f Add Discord community version (64-bit only)
- Added realracing3-community.apk (71.57 MB)
- Removed 32-bit support (armeabi-v7a)
- Only includes arm64-v8a libraries
- Decompiled source code included
- Added README-community.md with analysis
2026-02-18 15:48:36 -08:00

1499 lines
58 KiB
Java
Raw Permalink Blame History

package com.google.protobuf;
import com.applovin.exoplayer2.common.base.Ascii;
import com.mbridge.msdk.playercommon.exoplayer2.extractor.ts.PsExtractor;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
import java.util.Arrays;
/* loaded from: classes3.dex */
public final class Utf8 {
private static final long ASCII_MASK_LONG = -9187201950435737472L;
static final int COMPLETE = 0;
static final int MALFORMED = -1;
static final int MAX_BYTES_PER_CHAR = 3;
private static final int UNSAFE_COUNT_ASCII_THRESHOLD = 16;
private static final Processor processor;
/* JADX INFO: Access modifiers changed from: private */
public static int incompleteStateFor(int i) {
if (i > -12) {
return -1;
}
return i;
}
/* JADX INFO: Access modifiers changed from: private */
public static int incompleteStateFor(int i, int i2) {
if (i > -12 || i2 > -65) {
return -1;
}
return i ^ (i2 << 8);
}
/* JADX INFO: Access modifiers changed from: private */
public static int incompleteStateFor(int i, int i2, int i3) {
if (i > -12 || i2 > -65 || i3 > -65) {
return -1;
}
return (i ^ (i2 << 8)) ^ (i3 << 16);
}
static {
Processor safeProcessor;
if (UnsafeProcessor.isAvailable() && !Android.isOnAndroidDevice()) {
safeProcessor = new UnsafeProcessor();
} else {
safeProcessor = new SafeProcessor();
}
processor = safeProcessor;
}
public static boolean isValidUtf8(byte[] bArr) {
return processor.isValidUtf8(bArr, 0, bArr.length);
}
public static boolean isValidUtf8(byte[] bArr, int i, int i2) {
return processor.isValidUtf8(bArr, i, i2);
}
public static int partialIsValidUtf8(int i, byte[] bArr, int i2, int i3) {
return processor.partialIsValidUtf8(i, bArr, i2, i3);
}
/* JADX INFO: Access modifiers changed from: private */
public static int incompleteStateFor(byte[] bArr, int i, int i2) {
byte b = bArr[i - 1];
int i3 = i2 - i;
if (i3 == 0) {
return incompleteStateFor(b);
}
if (i3 == 1) {
return incompleteStateFor(b, bArr[i]);
}
if (i3 == 2) {
return incompleteStateFor(b, bArr[i], bArr[i + 1]);
}
throw new AssertionError();
}
/* JADX INFO: Access modifiers changed from: private */
public static int incompleteStateFor(ByteBuffer byteBuffer, int i, int i2, int i3) {
if (i3 == 0) {
return incompleteStateFor(i);
}
if (i3 == 1) {
return incompleteStateFor(i, byteBuffer.get(i2));
}
if (i3 == 2) {
return incompleteStateFor(i, byteBuffer.get(i2), byteBuffer.get(i2 + 1));
}
throw new AssertionError();
}
public static class UnpairedSurrogateException extends IllegalArgumentException {
public UnpairedSurrogateException(int i, int i2) {
super("Unpaired surrogate at index " + i + " of " + i2);
}
}
public static int encodedLength(CharSequence charSequence) {
int length = charSequence.length();
int i = 0;
while (i < length && charSequence.charAt(i) < 128) {
i++;
}
int i2 = length;
while (true) {
if (i < length) {
char charAt = charSequence.charAt(i);
if (charAt >= 2048) {
i2 += encodedLengthGeneral(charSequence, i);
break;
}
i2 += (127 - charAt) >>> 31;
i++;
} else {
break;
}
}
if (i2 >= length) {
return i2;
}
throw new IllegalArgumentException("UTF-8 length does not fit in int: " + (i2 + 4294967296L));
}
private static int encodedLengthGeneral(CharSequence charSequence, int i) {
int length = charSequence.length();
int i2 = 0;
while (i < length) {
char charAt = charSequence.charAt(i);
if (charAt < 2048) {
i2 += (127 - charAt) >>> 31;
} else {
i2 += 2;
if (55296 <= charAt && charAt <= 57343) {
if (Character.codePointAt(charSequence, i) < 65536) {
throw new UnpairedSurrogateException(i, length);
}
i++;
}
}
i++;
}
return i2;
}
public static int encode(CharSequence charSequence, byte[] bArr, int i, int i2) {
return processor.encodeUtf8(charSequence, bArr, i, i2);
}
public static boolean isValidUtf8(ByteBuffer byteBuffer) {
return processor.isValidUtf8(byteBuffer, byteBuffer.position(), byteBuffer.remaining());
}
public static int partialIsValidUtf8(int i, ByteBuffer byteBuffer, int i2, int i3) {
return processor.partialIsValidUtf8(i, byteBuffer, i2, i3);
}
public static String decodeUtf8(ByteBuffer byteBuffer, int i, int i2) throws InvalidProtocolBufferException {
return processor.decodeUtf8(byteBuffer, i, i2);
}
public static String decodeUtf8(byte[] bArr, int i, int i2) throws InvalidProtocolBufferException {
return processor.decodeUtf8(bArr, i, i2);
}
public static void encodeUtf8(CharSequence charSequence, ByteBuffer byteBuffer) {
processor.encodeUtf8(charSequence, byteBuffer);
}
/* JADX INFO: Access modifiers changed from: private */
public static int estimateConsecutiveAscii(ByteBuffer byteBuffer, int i, int i2) {
int i3 = i2 - 7;
int i4 = i;
while (i4 < i3 && (byteBuffer.getLong(i4) & (-9187201950435737472L)) == 0) {
i4 += 8;
}
return i4 - i;
}
public static abstract class Processor {
public abstract String decodeUtf8(byte[] bArr, int i, int i2) throws InvalidProtocolBufferException;
public abstract String decodeUtf8Direct(ByteBuffer byteBuffer, int i, int i2) throws InvalidProtocolBufferException;
public abstract int encodeUtf8(CharSequence charSequence, byte[] bArr, int i, int i2);
public abstract void encodeUtf8Direct(CharSequence charSequence, ByteBuffer byteBuffer);
public abstract int partialIsValidUtf8(int i, byte[] bArr, int i2, int i3);
public abstract int partialIsValidUtf8Direct(int i, ByteBuffer byteBuffer, int i2, int i3);
public final boolean isValidUtf8(byte[] bArr, int i, int i2) {
return partialIsValidUtf8(0, bArr, i, i2) == 0;
}
public final boolean isValidUtf8(ByteBuffer byteBuffer, int i, int i2) {
return partialIsValidUtf8(0, byteBuffer, i, i2) == 0;
}
public final int partialIsValidUtf8(int i, ByteBuffer byteBuffer, int i2, int i3) {
if (byteBuffer.hasArray()) {
int arrayOffset = byteBuffer.arrayOffset();
return partialIsValidUtf8(i, byteBuffer.array(), i2 + arrayOffset, arrayOffset + i3);
}
if (byteBuffer.isDirect()) {
return partialIsValidUtf8Direct(i, byteBuffer, i2, i3);
}
return partialIsValidUtf8Default(i, byteBuffer, i2, i3);
}
/* JADX WARN: Code restructure failed: missing block: B:10:0x0017, code lost:
if (r8.get(r9) > (-65)) goto L13;
*/
/* JADX WARN: Code restructure failed: missing block: B:30:0x004c, code lost:
if (r8.get(r9) > (-65)) goto L32;
*/
/* JADX WARN: Code restructure failed: missing block: B:50:0x008f, code lost:
if (r8.get(r7) > (-65)) goto L53;
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public final int partialIsValidUtf8Default(int r7, java.nio.ByteBuffer r8, int r9, int r10) {
/*
r6 = this;
if (r7 == 0) goto L92
if (r9 < r10) goto L5
return r7
L5:
byte r0 = (byte) r7
r1 = -32
r2 = -1
r3 = -65
if (r0 >= r1) goto L1e
r7 = -62
if (r0 < r7) goto L1d
int r7 = r9 + 1
byte r9 = r8.get(r9)
if (r9 <= r3) goto L1a
goto L1d
L1a:
r9 = r7
goto L92
L1d:
return r2
L1e:
r4 = -16
if (r0 >= r4) goto L4f
int r7 = r7 >> 8
int r7 = ~r7
byte r7 = (byte) r7
if (r7 != 0) goto L38
int r7 = r9 + 1
byte r9 = r8.get(r9)
if (r7 < r10) goto L35
int r7 = com.google.protobuf.Utf8.access$000(r0, r9)
return r7
L35:
r5 = r9
r9 = r7
r7 = r5
L38:
if (r7 > r3) goto L4e
r4 = -96
if (r0 != r1) goto L40
if (r7 < r4) goto L4e
L40:
r1 = -19
if (r0 != r1) goto L46
if (r7 >= r4) goto L4e
L46:
int r7 = r9 + 1
byte r9 = r8.get(r9)
if (r9 <= r3) goto L1a
L4e:
return r2
L4f:
int r1 = r7 >> 8
int r1 = ~r1
byte r1 = (byte) r1
if (r1 != 0) goto L64
int r7 = r9 + 1
byte r1 = r8.get(r9)
if (r7 < r10) goto L62
int r7 = com.google.protobuf.Utf8.access$000(r0, r1)
return r7
L62:
r9 = 0
goto L6a
L64:
int r7 = r7 >> 16
byte r7 = (byte) r7
r5 = r9
r9 = r7
r7 = r5
L6a:
if (r9 != 0) goto L7c
int r9 = r7 + 1
byte r7 = r8.get(r7)
if (r9 < r10) goto L79
int r7 = com.google.protobuf.Utf8.access$100(r0, r1, r7)
return r7
L79:
r5 = r9
r9 = r7
r7 = r5
L7c:
if (r1 > r3) goto L91
int r0 = r0 << 28
int r1 = r1 + 112
int r0 = r0 + r1
int r0 = r0 >> 30
if (r0 != 0) goto L91
if (r9 > r3) goto L91
int r9 = r7 + 1
byte r7 = r8.get(r7)
if (r7 <= r3) goto L92
L91:
return r2
L92:
int r7 = partialIsValidUtf8(r8, r9, r10)
return r7
*/
throw new UnsupportedOperationException("Method not decompiled: com.google.protobuf.Utf8.Processor.partialIsValidUtf8Default(int, java.nio.ByteBuffer, int, int):int");
}
private static int partialIsValidUtf8(ByteBuffer byteBuffer, int i, int i2) {
int estimateConsecutiveAscii = i + Utf8.estimateConsecutiveAscii(byteBuffer, i, i2);
while (estimateConsecutiveAscii < i2) {
int i3 = estimateConsecutiveAscii + 1;
byte b = byteBuffer.get(estimateConsecutiveAscii);
if (b >= 0) {
estimateConsecutiveAscii = i3;
} else if (b < -32) {
if (i3 >= i2) {
return b;
}
if (b < -62 || byteBuffer.get(i3) > -65) {
return -1;
}
estimateConsecutiveAscii += 2;
} else {
if (b >= -16) {
if (i3 >= i2 - 2) {
return Utf8.incompleteStateFor(byteBuffer, b, i3, i2 - i3);
}
int i4 = estimateConsecutiveAscii + 2;
byte b2 = byteBuffer.get(i3);
if (b2 <= -65 && (((b << Ascii.FS) + (b2 + 112)) >> 30) == 0) {
int i5 = estimateConsecutiveAscii + 3;
if (byteBuffer.get(i4) <= -65) {
estimateConsecutiveAscii += 4;
if (byteBuffer.get(i5) > -65) {
}
}
}
return -1;
}
if (i3 >= i2 - 1) {
return Utf8.incompleteStateFor(byteBuffer, b, i3, i2 - i3);
}
int i6 = estimateConsecutiveAscii + 2;
byte b3 = byteBuffer.get(i3);
if (b3 > -65 || ((b == -32 && b3 < -96) || ((b == -19 && b3 >= -96) || byteBuffer.get(i6) > -65))) {
return -1;
}
estimateConsecutiveAscii += 3;
}
}
return 0;
}
public final String decodeUtf8(ByteBuffer byteBuffer, int i, int i2) throws InvalidProtocolBufferException {
if (byteBuffer.hasArray()) {
return decodeUtf8(byteBuffer.array(), byteBuffer.arrayOffset() + i, i2);
}
if (byteBuffer.isDirect()) {
return decodeUtf8Direct(byteBuffer, i, i2);
}
return decodeUtf8Default(byteBuffer, i, i2);
}
public final String decodeUtf8Default(ByteBuffer byteBuffer, int i, int i2) throws InvalidProtocolBufferException {
if ((i | i2 | ((byteBuffer.limit() - i) - i2)) < 0) {
throw new ArrayIndexOutOfBoundsException(String.format("buffer limit=%d, index=%d, limit=%d", Integer.valueOf(byteBuffer.limit()), Integer.valueOf(i), Integer.valueOf(i2)));
}
int i3 = i + i2;
char[] cArr = new char[i2];
int i4 = 0;
while (i < i3) {
byte b = byteBuffer.get(i);
if (!DecodeUtil.isOneByte(b)) {
break;
}
i++;
DecodeUtil.handleOneByte(b, cArr, i4);
i4++;
}
int i5 = i4;
while (i < i3) {
int i6 = i + 1;
byte b2 = byteBuffer.get(i);
if (DecodeUtil.isOneByte(b2)) {
int i7 = i5 + 1;
DecodeUtil.handleOneByte(b2, cArr, i5);
while (i6 < i3) {
byte b3 = byteBuffer.get(i6);
if (!DecodeUtil.isOneByte(b3)) {
break;
}
i6++;
DecodeUtil.handleOneByte(b3, cArr, i7);
i7++;
}
i5 = i7;
i = i6;
} else if (DecodeUtil.isTwoBytes(b2)) {
if (i6 >= i3) {
throw InvalidProtocolBufferException.invalidUtf8();
}
i += 2;
DecodeUtil.handleTwoBytes(b2, byteBuffer.get(i6), cArr, i5);
i5++;
} else if (DecodeUtil.isThreeBytes(b2)) {
if (i6 >= i3 - 1) {
throw InvalidProtocolBufferException.invalidUtf8();
}
int i8 = i + 2;
i += 3;
DecodeUtil.handleThreeBytes(b2, byteBuffer.get(i6), byteBuffer.get(i8), cArr, i5);
i5++;
} else {
if (i6 >= i3 - 2) {
throw InvalidProtocolBufferException.invalidUtf8();
}
byte b4 = byteBuffer.get(i6);
int i9 = i + 3;
byte b5 = byteBuffer.get(i + 2);
i += 4;
DecodeUtil.handleFourBytes(b2, b4, b5, byteBuffer.get(i9), cArr, i5);
i5 += 2;
}
}
return new String(cArr, 0, i5);
}
public final void encodeUtf8(CharSequence charSequence, ByteBuffer byteBuffer) {
if (byteBuffer.hasArray()) {
int arrayOffset = byteBuffer.arrayOffset();
} else if (byteBuffer.isDirect()) {
encodeUtf8Direct(charSequence, byteBuffer);
} else {
encodeUtf8Default(charSequence, byteBuffer);
}
}
public final void encodeUtf8Default(CharSequence charSequence, ByteBuffer byteBuffer) {
int i;
int length = charSequence.length();
int position = byteBuffer.position();
int i2 = 0;
while (i2 < length) {
try {
char charAt = charSequence.charAt(i2);
if (charAt >= 128) {
break;
}
byteBuffer.put(position + i2, (byte) charAt);
i2++;
} catch (IndexOutOfBoundsException unused) {
throw new ArrayIndexOutOfBoundsException("Failed writing " + charSequence.charAt(i2) + " at index " + (byteBuffer.position() + Math.max(i2, (position - byteBuffer.position()) + 1)));
}
}
if (i2 == length) {
return;
}
position += i2;
while (i2 < length) {
char charAt2 = charSequence.charAt(i2);
if (charAt2 < 128) {
byteBuffer.put(position, (byte) charAt2);
} else if (charAt2 < 2048) {
int i3 = position + 1;
try {
byteBuffer.put(position, (byte) ((charAt2 >>> 6) | PsExtractor.AUDIO_STREAM));
byteBuffer.put(i3, (byte) ((charAt2 & '?') | 128));
position = i3;
} catch (IndexOutOfBoundsException unused2) {
position = i3;
throw new ArrayIndexOutOfBoundsException("Failed writing " + charSequence.charAt(i2) + " at index " + (byteBuffer.position() + Math.max(i2, (position - byteBuffer.position()) + 1)));
}
} else if (charAt2 < 55296 || 57343 < charAt2) {
int i4 = position + 1;
byteBuffer.put(position, (byte) ((charAt2 >>> '\f') | 224));
position += 2;
byteBuffer.put(i4, (byte) (((charAt2 >>> 6) & 63) | 128));
byteBuffer.put(position, (byte) ((charAt2 & '?') | 128));
} else {
int i5 = i2 + 1;
if (i5 != length) {
try {
char charAt3 = charSequence.charAt(i5);
if (Character.isSurrogatePair(charAt2, charAt3)) {
int codePoint = Character.toCodePoint(charAt2, charAt3);
int i6 = position + 1;
try {
byteBuffer.put(position, (byte) ((codePoint >>> 18) | PsExtractor.VIDEO_STREAM_MASK));
i = position + 2;
} catch (IndexOutOfBoundsException unused3) {
position = i6;
i2 = i5;
throw new ArrayIndexOutOfBoundsException("Failed writing " + charSequence.charAt(i2) + " at index " + (byteBuffer.position() + Math.max(i2, (position - byteBuffer.position()) + 1)));
}
try {
byteBuffer.put(i6, (byte) (((codePoint >>> 12) & 63) | 128));
position += 3;
byteBuffer.put(i, (byte) (((codePoint >>> 6) & 63) | 128));
byteBuffer.put(position, (byte) ((codePoint & 63) | 128));
i2 = i5;
} catch (IndexOutOfBoundsException unused4) {
i2 = i5;
position = i;
throw new ArrayIndexOutOfBoundsException("Failed writing " + charSequence.charAt(i2) + " at index " + (byteBuffer.position() + Math.max(i2, (position - byteBuffer.position()) + 1)));
}
} else {
i2 = i5;
}
} catch (IndexOutOfBoundsException unused5) {
}
}
throw new UnpairedSurrogateException(i2, length);
}
i2++;
position++;
}
}
}
public static final class SafeProcessor extends Processor {
/* JADX WARN: Code restructure failed: missing block: B:10:0x0015, code lost:
if (r8[r9] > (-65)) goto L13;
*/
/* JADX WARN: Code restructure failed: missing block: B:30:0x0046, code lost:
if (r8[r9] > (-65)) goto L32;
*/
/* JADX WARN: Code restructure failed: missing block: B:50:0x0083, code lost:
if (r8[r7] > (-65)) goto L53;
*/
@Override // com.google.protobuf.Utf8.Processor
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public int partialIsValidUtf8(int r7, byte[] r8, int r9, int r10) {
/*
r6 = this;
if (r7 == 0) goto L86
if (r9 < r10) goto L5
return r7
L5:
byte r0 = (byte) r7
r1 = -32
r2 = -1
r3 = -65
if (r0 >= r1) goto L1c
r7 = -62
if (r0 < r7) goto L1b
int r7 = r9 + 1
r9 = r8[r9]
if (r9 <= r3) goto L18
goto L1b
L18:
r9 = r7
goto L86
L1b:
return r2
L1c:
r4 = -16
if (r0 >= r4) goto L49
int r7 = r7 >> 8
int r7 = ~r7
byte r7 = (byte) r7
if (r7 != 0) goto L34
int r7 = r9 + 1
r9 = r8[r9]
if (r7 < r10) goto L31
int r7 = com.google.protobuf.Utf8.access$000(r0, r9)
return r7
L31:
r5 = r9
r9 = r7
r7 = r5
L34:
if (r7 > r3) goto L48
r4 = -96
if (r0 != r1) goto L3c
if (r7 < r4) goto L48
L3c:
r1 = -19
if (r0 != r1) goto L42
if (r7 >= r4) goto L48
L42:
int r7 = r9 + 1
r9 = r8[r9]
if (r9 <= r3) goto L18
L48:
return r2
L49:
int r1 = r7 >> 8
int r1 = ~r1
byte r1 = (byte) r1
if (r1 != 0) goto L5c
int r7 = r9 + 1
r1 = r8[r9]
if (r7 < r10) goto L5a
int r7 = com.google.protobuf.Utf8.access$000(r0, r1)
return r7
L5a:
r9 = 0
goto L62
L5c:
int r7 = r7 >> 16
byte r7 = (byte) r7
r5 = r9
r9 = r7
r7 = r5
L62:
if (r9 != 0) goto L72
int r9 = r7 + 1
r7 = r8[r7]
if (r9 < r10) goto L6f
int r7 = com.google.protobuf.Utf8.access$100(r0, r1, r7)
return r7
L6f:
r5 = r9
r9 = r7
r7 = r5
L72:
if (r1 > r3) goto L85
int r0 = r0 << 28
int r1 = r1 + 112
int r0 = r0 + r1
int r0 = r0 >> 30
if (r0 != 0) goto L85
if (r9 > r3) goto L85
int r9 = r7 + 1
r7 = r8[r7]
if (r7 <= r3) goto L86
L85:
return r2
L86:
int r7 = partialIsValidUtf8(r8, r9, r10)
return r7
*/
throw new UnsupportedOperationException("Method not decompiled: com.google.protobuf.Utf8.SafeProcessor.partialIsValidUtf8(int, byte[], int, int):int");
}
@Override // com.google.protobuf.Utf8.Processor
public int partialIsValidUtf8Direct(int i, ByteBuffer byteBuffer, int i2, int i3) {
return partialIsValidUtf8Default(i, byteBuffer, i2, i3);
}
@Override // com.google.protobuf.Utf8.Processor
public String decodeUtf8(byte[] bArr, int i, int i2) throws InvalidProtocolBufferException {
if ((i | i2 | ((bArr.length - i) - i2)) < 0) {
throw new ArrayIndexOutOfBoundsException(String.format("buffer length=%d, index=%d, size=%d", Integer.valueOf(bArr.length), Integer.valueOf(i), Integer.valueOf(i2)));
}
int i3 = i + i2;
char[] cArr = new char[i2];
int i4 = 0;
while (i < i3) {
byte b = bArr[i];
if (!DecodeUtil.isOneByte(b)) {
break;
}
i++;
DecodeUtil.handleOneByte(b, cArr, i4);
i4++;
}
int i5 = i4;
while (i < i3) {
int i6 = i + 1;
byte b2 = bArr[i];
if (DecodeUtil.isOneByte(b2)) {
int i7 = i5 + 1;
DecodeUtil.handleOneByte(b2, cArr, i5);
while (i6 < i3) {
byte b3 = bArr[i6];
if (!DecodeUtil.isOneByte(b3)) {
break;
}
i6++;
DecodeUtil.handleOneByte(b3, cArr, i7);
i7++;
}
i5 = i7;
i = i6;
} else if (DecodeUtil.isTwoBytes(b2)) {
if (i6 >= i3) {
throw InvalidProtocolBufferException.invalidUtf8();
}
i += 2;
DecodeUtil.handleTwoBytes(b2, bArr[i6], cArr, i5);
i5++;
} else if (DecodeUtil.isThreeBytes(b2)) {
if (i6 >= i3 - 1) {
throw InvalidProtocolBufferException.invalidUtf8();
}
int i8 = i + 2;
i += 3;
DecodeUtil.handleThreeBytes(b2, bArr[i6], bArr[i8], cArr, i5);
i5++;
} else {
if (i6 >= i3 - 2) {
throw InvalidProtocolBufferException.invalidUtf8();
}
byte b4 = bArr[i6];
int i9 = i + 3;
byte b5 = bArr[i + 2];
i += 4;
DecodeUtil.handleFourBytes(b2, b4, b5, bArr[i9], cArr, i5);
i5 += 2;
}
}
return new String(cArr, 0, i5);
}
@Override // com.google.protobuf.Utf8.Processor
public String decodeUtf8Direct(ByteBuffer byteBuffer, int i, int i2) throws InvalidProtocolBufferException {
return decodeUtf8Default(byteBuffer, i, i2);
}
/* JADX WARN: Code restructure failed: missing block: B:12:0x001d, code lost:
return r10 + r0;
*/
@Override // com.google.protobuf.Utf8.Processor
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public int encodeUtf8(java.lang.CharSequence r8, byte[] r9, int r10, int r11) {
/*
Method dump skipped, instructions count: 254
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: com.google.protobuf.Utf8.SafeProcessor.encodeUtf8(java.lang.CharSequence, byte[], int, int):int");
}
@Override // com.google.protobuf.Utf8.Processor
public void encodeUtf8Direct(CharSequence charSequence, ByteBuffer byteBuffer) {
encodeUtf8Default(charSequence, byteBuffer);
}
private static int partialIsValidUtf8(byte[] bArr, int i, int i2) {
while (i < i2 && bArr[i] >= 0) {
i++;
}
if (i >= i2) {
return 0;
}
return partialIsValidUtf8NonAscii(bArr, i, i2);
}
private static int partialIsValidUtf8NonAscii(byte[] bArr, int i, int i2) {
while (i < i2) {
int i3 = i + 1;
byte b = bArr[i];
if (b < 0) {
if (b < -32) {
if (i3 >= i2) {
return b;
}
if (b >= -62) {
i += 2;
if (bArr[i3] > -65) {
}
}
return -1;
}
if (b >= -16) {
if (i3 >= i2 - 2) {
return Utf8.incompleteStateFor(bArr, i3, i2);
}
int i4 = i + 2;
byte b2 = bArr[i3];
if (b2 <= -65 && (((b << Ascii.FS) + (b2 + 112)) >> 30) == 0) {
int i5 = i + 3;
if (bArr[i4] <= -65) {
i += 4;
if (bArr[i5] > -65) {
}
}
}
return -1;
}
if (i3 >= i2 - 1) {
return Utf8.incompleteStateFor(bArr, i3, i2);
}
int i6 = i + 2;
byte b3 = bArr[i3];
if (b3 <= -65 && ((b != -32 || b3 >= -96) && (b != -19 || b3 < -96))) {
i += 3;
if (bArr[i6] > -65) {
}
}
return -1;
}
i = i3;
}
return 0;
}
}
public static final class UnsafeProcessor extends Processor {
public static boolean isAvailable() {
return UnsafeUtil.hasUnsafeArrayOperations() && UnsafeUtil.hasUnsafeByteBufferOperations();
}
/* JADX WARN: Code restructure failed: missing block: B:34:0x0058, code lost:
if (com.google.protobuf.UnsafeUtil.getByte(r12, r0) > (-65)) goto L38;
*/
/* JADX WARN: Code restructure failed: missing block: B:55:0x009e, code lost:
if (com.google.protobuf.UnsafeUtil.getByte(r12, r0) > (-65)) goto L59;
*/
@Override // com.google.protobuf.Utf8.Processor
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public int partialIsValidUtf8(int r11, byte[] r12, int r13, int r14) {
/*
Method dump skipped, instructions count: 197
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: com.google.protobuf.Utf8.UnsafeProcessor.partialIsValidUtf8(int, byte[], int, int):int");
}
/* JADX WARN: Code restructure failed: missing block: B:14:0x002d, code lost:
if (com.google.protobuf.UnsafeUtil.getByte(r0) > (-65)) goto L17;
*/
/* JADX WARN: Code restructure failed: missing block: B:34:0x0061, code lost:
if (com.google.protobuf.UnsafeUtil.getByte(r0) > (-65)) goto L36;
*/
/* JADX WARN: Code restructure failed: missing block: B:54:0x00a3, code lost:
if (com.google.protobuf.UnsafeUtil.getByte(r0) > (-65)) goto L57;
*/
@Override // com.google.protobuf.Utf8.Processor
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public int partialIsValidUtf8Direct(int r10, java.nio.ByteBuffer r11, int r12, int r13) {
/*
Method dump skipped, instructions count: 205
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: com.google.protobuf.Utf8.UnsafeProcessor.partialIsValidUtf8Direct(int, java.nio.ByteBuffer, int, int):int");
}
@Override // com.google.protobuf.Utf8.Processor
public String decodeUtf8(byte[] bArr, int i, int i2) throws InvalidProtocolBufferException {
Charset charset = Internal.UTF_8;
String str = new String(bArr, i, i2, charset);
if (str.contains("<EFBFBD>") && !Arrays.equals(str.getBytes(charset), Arrays.copyOfRange(bArr, i, i2 + i))) {
throw InvalidProtocolBufferException.invalidUtf8();
}
return str;
}
@Override // com.google.protobuf.Utf8.Processor
public String decodeUtf8Direct(ByteBuffer byteBuffer, int i, int i2) throws InvalidProtocolBufferException {
if ((i | i2 | ((byteBuffer.limit() - i) - i2)) < 0) {
throw new ArrayIndexOutOfBoundsException(String.format("buffer limit=%d, index=%d, limit=%d", Integer.valueOf(byteBuffer.limit()), Integer.valueOf(i), Integer.valueOf(i2)));
}
long addressOffset = UnsafeUtil.addressOffset(byteBuffer) + i;
long j = i2 + addressOffset;
char[] cArr = new char[i2];
int i3 = 0;
while (addressOffset < j) {
byte b = UnsafeUtil.getByte(addressOffset);
if (!DecodeUtil.isOneByte(b)) {
break;
}
addressOffset++;
DecodeUtil.handleOneByte(b, cArr, i3);
i3++;
}
int i4 = i3;
while (addressOffset < j) {
long j2 = addressOffset + 1;
byte b2 = UnsafeUtil.getByte(addressOffset);
if (DecodeUtil.isOneByte(b2)) {
int i5 = i4 + 1;
DecodeUtil.handleOneByte(b2, cArr, i4);
while (j2 < j) {
byte b3 = UnsafeUtil.getByte(j2);
if (!DecodeUtil.isOneByte(b3)) {
break;
}
j2++;
DecodeUtil.handleOneByte(b3, cArr, i5);
i5++;
}
i4 = i5;
addressOffset = j2;
} else if (DecodeUtil.isTwoBytes(b2)) {
if (j2 >= j) {
throw InvalidProtocolBufferException.invalidUtf8();
}
addressOffset += 2;
DecodeUtil.handleTwoBytes(b2, UnsafeUtil.getByte(j2), cArr, i4);
i4++;
} else if (DecodeUtil.isThreeBytes(b2)) {
if (j2 >= j - 1) {
throw InvalidProtocolBufferException.invalidUtf8();
}
long j3 = 2 + addressOffset;
addressOffset += 3;
DecodeUtil.handleThreeBytes(b2, UnsafeUtil.getByte(j2), UnsafeUtil.getByte(j3), cArr, i4);
i4++;
} else {
if (j2 >= j - 2) {
throw InvalidProtocolBufferException.invalidUtf8();
}
byte b4 = UnsafeUtil.getByte(j2);
long j4 = 3 + addressOffset;
byte b5 = UnsafeUtil.getByte(2 + addressOffset);
addressOffset += 4;
DecodeUtil.handleFourBytes(b2, b4, b5, UnsafeUtil.getByte(j4), cArr, i4);
i4 += 2;
}
}
return new String(cArr, 0, i4);
}
@Override // com.google.protobuf.Utf8.Processor
public int encodeUtf8(CharSequence charSequence, byte[] bArr, int i, int i2) {
long j;
String str;
String str2;
int i3;
long j2;
long j3;
char charAt;
long j4 = i;
long j5 = i2 + j4;
int length = charSequence.length();
String str3 = " at index ";
String str4 = "Failed writing ";
if (length > i2 || bArr.length - i2 < i) {
throw new ArrayIndexOutOfBoundsException("Failed writing " + charSequence.charAt(length - 1) + " at index " + (i + i2));
}
int i4 = 0;
while (true) {
j = 1;
if (i4 >= length || (charAt = charSequence.charAt(i4)) >= 128) {
break;
}
UnsafeUtil.putByte(bArr, j4, (byte) charAt);
i4++;
j4 = 1 + j4;
}
if (i4 == length) {
return (int) j4;
}
while (i4 < length) {
char charAt2 = charSequence.charAt(i4);
if (charAt2 >= 128 || j4 >= j5) {
if (charAt2 >= 2048 || j4 > j5 - 2) {
str = str3;
str2 = str4;
if ((charAt2 >= 55296 && 57343 >= charAt2) || j4 > j5 - 3) {
if (j4 <= j5 - 4) {
int i5 = i4 + 1;
if (i5 != length) {
char charAt3 = charSequence.charAt(i5);
if (Character.isSurrogatePair(charAt2, charAt3)) {
int codePoint = Character.toCodePoint(charAt2, charAt3);
j2 = 1;
UnsafeUtil.putByte(bArr, j4, (byte) ((codePoint >>> 18) | PsExtractor.VIDEO_STREAM_MASK));
j3 = j5;
UnsafeUtil.putByte(bArr, j4 + 1, (byte) (((codePoint >>> 12) & 63) | 128));
long j6 = j4 + 3;
UnsafeUtil.putByte(bArr, j4 + 2, (byte) (((codePoint >>> 6) & 63) | 128));
j4 += 4;
UnsafeUtil.putByte(bArr, j6, (byte) ((codePoint & 63) | 128));
i4 = i5;
} else {
i4 = i5;
}
}
throw new UnpairedSurrogateException(i4 - 1, length);
}
if (55296 <= charAt2 && charAt2 <= 57343 && ((i3 = i4 + 1) == length || !Character.isSurrogatePair(charAt2, charSequence.charAt(i3)))) {
throw new UnpairedSurrogateException(i4, length);
}
throw new ArrayIndexOutOfBoundsException(str2 + charAt2 + str + j4);
}
UnsafeUtil.putByte(bArr, j4, (byte) ((charAt2 >>> '\f') | 480));
long j7 = j4 + 2;
UnsafeUtil.putByte(bArr, j4 + 1, (byte) (((charAt2 >>> 6) & 63) | 128));
j4 += 3;
UnsafeUtil.putByte(bArr, j7, (byte) ((charAt2 & '?') | 128));
} else {
str = str3;
str2 = str4;
long j8 = j4 + j;
UnsafeUtil.putByte(bArr, j4, (byte) ((charAt2 >>> 6) | 960));
j4 += 2;
UnsafeUtil.putByte(bArr, j8, (byte) ((charAt2 & '?') | 128));
}
j3 = j5;
j2 = 1;
} else {
UnsafeUtil.putByte(bArr, j4, (byte) charAt2);
j3 = j5;
str2 = str4;
j2 = j;
j4 += j;
str = str3;
}
i4++;
str3 = str;
str4 = str2;
j = j2;
j5 = j3;
}
return (int) j4;
}
@Override // com.google.protobuf.Utf8.Processor
public void encodeUtf8Direct(CharSequence charSequence, ByteBuffer byteBuffer) {
long j;
char c;
long j2;
int i;
int i2;
char c2;
char charAt;
long addressOffset = UnsafeUtil.addressOffset(byteBuffer);
long position = byteBuffer.position() + addressOffset;
long limit = byteBuffer.limit() + addressOffset;
int length = charSequence.length();
if (length > limit - position) {
throw new ArrayIndexOutOfBoundsException("Failed writing " + charSequence.charAt(length - 1) + " at index " + byteBuffer.limit());
}
int i3 = 0;
while (true) {
j = 1;
c = 128;
if (i3 >= length || (charAt = charSequence.charAt(i3)) >= 128) {
break;
}
UnsafeUtil.putByte(position, (byte) charAt);
i3++;
position = 1 + position;
}
if (i3 == length) {
return;
}
while (i3 < length) {
char charAt2 = charSequence.charAt(i3);
if (charAt2 >= c || position >= limit) {
if (charAt2 >= 2048 || position > limit - 2) {
j2 = addressOffset;
if ((charAt2 >= 55296 && 57343 >= charAt2) || position > limit - 3) {
if (position <= limit - 4) {
i2 = i3 + 1;
if (i2 != length) {
char charAt3 = charSequence.charAt(i2);
if (Character.isSurrogatePair(charAt2, charAt3)) {
int codePoint = Character.toCodePoint(charAt2, charAt3);
UnsafeUtil.putByte(position, (byte) ((codePoint >>> 18) | PsExtractor.VIDEO_STREAM_MASK));
c2 = 128;
UnsafeUtil.putByte(position + 1, (byte) (((codePoint >>> 12) & 63) | 128));
long j3 = position + 3;
UnsafeUtil.putByte(position + 2, (byte) (((codePoint >>> 6) & 63) | 128));
position += 4;
UnsafeUtil.putByte(j3, (byte) ((codePoint & 63) | 128));
} else {
i3 = i2;
}
}
throw new UnpairedSurrogateException(i3 - 1, length);
}
if (55296 <= charAt2 && charAt2 <= 57343 && ((i = i3 + 1) == length || !Character.isSurrogatePair(charAt2, charSequence.charAt(i)))) {
throw new UnpairedSurrogateException(i3, length);
}
throw new ArrayIndexOutOfBoundsException("Failed writing " + charAt2 + " at index " + position);
}
long j4 = position + j;
UnsafeUtil.putByte(position, (byte) ((charAt2 >>> '\f') | 480));
long j5 = position + 2;
UnsafeUtil.putByte(j4, (byte) (((charAt2 >>> 6) & 63) | 128));
position += 3;
UnsafeUtil.putByte(j5, (byte) ((charAt2 & '?') | 128));
} else {
j2 = addressOffset;
long j6 = position + j;
UnsafeUtil.putByte(position, (byte) ((charAt2 >>> 6) | 960));
position += 2;
UnsafeUtil.putByte(j6, (byte) ((charAt2 & '?') | 128));
}
i2 = i3;
c2 = 128;
} else {
UnsafeUtil.putByte(position, (byte) charAt2);
j2 = addressOffset;
i2 = i3;
c2 = c;
position += j;
}
c = c2;
addressOffset = j2;
j = 1;
i3 = i2 + 1;
}
}
private static int unsafeEstimateConsecutiveAscii(byte[] bArr, long j, int i) {
int i2 = 0;
if (i < 16) {
return 0;
}
int i3 = 8 - (((int) j) & 7);
while (i2 < i3) {
long j2 = 1 + j;
if (UnsafeUtil.getByte(bArr, j) < 0) {
return i2;
}
i2++;
j = j2;
}
while (true) {
int i4 = i2 + 8;
if (i4 > i || (UnsafeUtil.getLong((Object) bArr, UnsafeUtil.BYTE_ARRAY_BASE_OFFSET + j) & (-9187201950435737472L)) != 0) {
break;
}
j += 8;
i2 = i4;
}
while (i2 < i) {
long j3 = j + 1;
if (UnsafeUtil.getByte(bArr, j) < 0) {
return i2;
}
i2++;
j = j3;
}
return i;
}
private static int unsafeEstimateConsecutiveAscii(long j, int i) {
if (i < 16) {
return 0;
}
int i2 = (int) ((-j) & 7);
int i3 = i2;
while (i3 > 0) {
long j2 = 1 + j;
if (UnsafeUtil.getByte(j) < 0) {
return i2 - i3;
}
i3--;
j = j2;
}
int i4 = i - i2;
while (i4 >= 8 && (UnsafeUtil.getLong(j) & (-9187201950435737472L)) == 0) {
j += 8;
i4 -= 8;
}
return i - i4;
}
/* JADX WARN: Code restructure failed: missing block: B:69:0x0039, code lost:
return -1;
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
private static int partialIsValidUtf8(byte[] r10, long r11, int r13) {
/*
int r0 = unsafeEstimateConsecutiveAscii(r10, r11, r13)
int r13 = r13 - r0
long r0 = (long) r0
long r11 = r11 + r0
L7:
r0 = 0
r1 = r0
L9:
r2 = 1
if (r13 <= 0) goto L1a
long r4 = r11 + r2
byte r1 = com.google.protobuf.UnsafeUtil.getByte(r10, r11)
if (r1 < 0) goto L19
int r13 = r13 + (-1)
r11 = r4
goto L9
L19:
r11 = r4
L1a:
if (r13 != 0) goto L1d
return r0
L1d:
int r0 = r13 + (-1)
r4 = -32
r5 = -1
r6 = -65
if (r1 >= r4) goto L3a
if (r0 != 0) goto L29
return r1
L29:
int r13 = r13 + (-2)
r0 = -62
if (r1 < r0) goto L39
long r2 = r2 + r11
byte r11 = com.google.protobuf.UnsafeUtil.getByte(r10, r11)
if (r11 <= r6) goto L37
goto L39
L37:
r11 = r2
goto L7
L39:
return r5
L3a:
r7 = -16
r8 = 2
if (r1 >= r7) goto L65
r7 = 2
if (r0 >= r7) goto L48
int r10 = unsafeIncompleteStateFor(r10, r1, r11, r0)
return r10
L48:
int r13 = r13 + (-3)
long r2 = r2 + r11
byte r0 = com.google.protobuf.UnsafeUtil.getByte(r10, r11)
if (r0 > r6) goto L64
r7 = -96
if (r1 != r4) goto L57
if (r0 < r7) goto L64
L57:
r4 = -19
if (r1 != r4) goto L5d
if (r0 >= r7) goto L64
L5d:
long r11 = r11 + r8
byte r0 = com.google.protobuf.UnsafeUtil.getByte(r10, r2)
if (r0 <= r6) goto L7
L64:
return r5
L65:
r4 = 3
if (r0 >= r4) goto L6d
int r10 = unsafeIncompleteStateFor(r10, r1, r11, r0)
return r10
L6d:
int r13 = r13 + (-4)
long r2 = r2 + r11
byte r0 = com.google.protobuf.UnsafeUtil.getByte(r10, r11)
if (r0 > r6) goto L8f
int r1 = r1 << 28
int r0 = r0 + 112
int r1 = r1 + r0
int r0 = r1 >> 30
if (r0 != 0) goto L8f
long r8 = r8 + r11
byte r0 = com.google.protobuf.UnsafeUtil.getByte(r10, r2)
if (r0 > r6) goto L8f
r0 = 3
long r11 = r11 + r0
byte r0 = com.google.protobuf.UnsafeUtil.getByte(r10, r8)
if (r0 <= r6) goto L7
L8f:
return r5
*/
throw new UnsupportedOperationException("Method not decompiled: com.google.protobuf.Utf8.UnsafeProcessor.partialIsValidUtf8(byte[], long, int):int");
}
/* JADX WARN: Code restructure failed: missing block: B:69:0x0039, code lost:
return -1;
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
private static int partialIsValidUtf8(long r10, int r12) {
/*
int r0 = unsafeEstimateConsecutiveAscii(r10, r12)
long r1 = (long) r0
long r10 = r10 + r1
int r12 = r12 - r0
L7:
r0 = 0
r1 = r0
L9:
r2 = 1
if (r12 <= 0) goto L1a
long r4 = r10 + r2
byte r1 = com.google.protobuf.UnsafeUtil.getByte(r10)
if (r1 < 0) goto L19
int r12 = r12 + (-1)
r10 = r4
goto L9
L19:
r10 = r4
L1a:
if (r12 != 0) goto L1d
return r0
L1d:
int r0 = r12 + (-1)
r4 = -32
r5 = -1
r6 = -65
if (r1 >= r4) goto L3a
if (r0 != 0) goto L29
return r1
L29:
int r12 = r12 + (-2)
r0 = -62
if (r1 < r0) goto L39
long r2 = r2 + r10
byte r10 = com.google.protobuf.UnsafeUtil.getByte(r10)
if (r10 <= r6) goto L37
goto L39
L37:
r10 = r2
goto L7
L39:
return r5
L3a:
r7 = -16
r8 = 2
if (r1 >= r7) goto L65
r7 = 2
if (r0 >= r7) goto L48
int r10 = unsafeIncompleteStateFor(r10, r1, r0)
return r10
L48:
int r12 = r12 + (-3)
long r2 = r2 + r10
byte r0 = com.google.protobuf.UnsafeUtil.getByte(r10)
if (r0 > r6) goto L64
r7 = -96
if (r1 != r4) goto L57
if (r0 < r7) goto L64
L57:
r4 = -19
if (r1 != r4) goto L5d
if (r0 >= r7) goto L64
L5d:
long r10 = r10 + r8
byte r0 = com.google.protobuf.UnsafeUtil.getByte(r2)
if (r0 <= r6) goto L7
L64:
return r5
L65:
r4 = 3
if (r0 >= r4) goto L6d
int r10 = unsafeIncompleteStateFor(r10, r1, r0)
return r10
L6d:
int r12 = r12 + (-4)
long r2 = r2 + r10
byte r0 = com.google.protobuf.UnsafeUtil.getByte(r10)
if (r0 > r6) goto L8f
int r1 = r1 << 28
int r0 = r0 + 112
int r1 = r1 + r0
int r0 = r1 >> 30
if (r0 != 0) goto L8f
long r8 = r8 + r10
byte r0 = com.google.protobuf.UnsafeUtil.getByte(r2)
if (r0 > r6) goto L8f
r0 = 3
long r10 = r10 + r0
byte r0 = com.google.protobuf.UnsafeUtil.getByte(r8)
if (r0 <= r6) goto L7
L8f:
return r5
*/
throw new UnsupportedOperationException("Method not decompiled: com.google.protobuf.Utf8.UnsafeProcessor.partialIsValidUtf8(long, int):int");
}
private static int unsafeIncompleteStateFor(byte[] bArr, int i, long j, int i2) {
if (i2 == 0) {
return Utf8.incompleteStateFor(i);
}
if (i2 == 1) {
return Utf8.incompleteStateFor(i, UnsafeUtil.getByte(bArr, j));
}
if (i2 == 2) {
return Utf8.incompleteStateFor(i, UnsafeUtil.getByte(bArr, j), UnsafeUtil.getByte(bArr, j + 1));
}
throw new AssertionError();
}
private static int unsafeIncompleteStateFor(long j, int i, int i2) {
if (i2 == 0) {
return Utf8.incompleteStateFor(i);
}
if (i2 == 1) {
return Utf8.incompleteStateFor(i, UnsafeUtil.getByte(j));
}
if (i2 == 2) {
return Utf8.incompleteStateFor(i, UnsafeUtil.getByte(j), UnsafeUtil.getByte(j + 1));
}
throw new AssertionError();
}
}
public static class DecodeUtil {
private static char highSurrogate(int i) {
return (char) ((i >>> 10) + 55232);
}
private static boolean isNotTrailingByte(byte b) {
return b > -65;
}
/* JADX INFO: Access modifiers changed from: private */
public static boolean isOneByte(byte b) {
return b >= 0;
}
/* JADX INFO: Access modifiers changed from: private */
public static boolean isThreeBytes(byte b) {
return b < -16;
}
/* JADX INFO: Access modifiers changed from: private */
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 & 63;
}
private DecodeUtil() {
}
/* JADX INFO: Access modifiers changed from: private */
public static void handleOneByte(byte b, char[] cArr, int i) {
cArr[i] = (char) b;
}
/* JADX INFO: Access modifiers changed from: private */
public static void handleTwoBytes(byte b, byte b2, char[] cArr, int i) throws InvalidProtocolBufferException {
if (b < -62 || isNotTrailingByte(b2)) {
throw InvalidProtocolBufferException.invalidUtf8();
}
cArr[i] = (char) (((b & Ascii.US) << 6) | trailingByteValue(b2));
}
/* JADX INFO: Access modifiers changed from: private */
public static void handleThreeBytes(byte b, byte b2, byte b3, char[] cArr, int i) throws InvalidProtocolBufferException {
if (isNotTrailingByte(b2) || ((b == -32 && b2 < -96) || ((b == -19 && b2 >= -96) || isNotTrailingByte(b3)))) {
throw InvalidProtocolBufferException.invalidUtf8();
}
cArr[i] = (char) (((b & Ascii.SI) << 12) | (trailingByteValue(b2) << 6) | trailingByteValue(b3));
}
/* JADX INFO: Access modifiers changed from: private */
public static void handleFourBytes(byte b, byte b2, byte b3, byte b4, char[] cArr, int i) throws InvalidProtocolBufferException {
if (isNotTrailingByte(b2) || (((b << Ascii.FS) + (b2 + 112)) >> 30) != 0 || isNotTrailingByte(b3) || isNotTrailingByte(b4)) {
throw InvalidProtocolBufferException.invalidUtf8();
}
int trailingByteValue = ((b & 7) << 18) | (trailingByteValue(b2) << 12) | (trailingByteValue(b3) << 6) | trailingByteValue(b4);
cArr[i] = highSurrogate(trailingByteValue);
cArr[i + 1] = lowSurrogate(trailingByteValue);
}
}
private Utf8() {
}
}