122 lines
5.4 KiB
Java
122 lines
5.4 KiB
Java
package com.google.android.gms.internal.measurement;
|
|
|
|
import com.ubtrobot.jimu.robotapi.PeripheralType;
|
|
import java.nio.ByteBuffer;
|
|
|
|
/* loaded from: classes.dex */
|
|
abstract class zzxn {
|
|
zzxn() {
|
|
}
|
|
|
|
static void b(CharSequence charSequence, ByteBuffer byteBuffer) {
|
|
int length = charSequence.length();
|
|
int position = byteBuffer.position();
|
|
int i = 0;
|
|
while (i < length) {
|
|
try {
|
|
char charAt = charSequence.charAt(i);
|
|
if (charAt >= 128) {
|
|
break;
|
|
}
|
|
byteBuffer.put(position + i, (byte) charAt);
|
|
i++;
|
|
} catch (IndexOutOfBoundsException unused) {
|
|
int position2 = byteBuffer.position() + Math.max(i, (position - byteBuffer.position()) + 1);
|
|
char charAt2 = charSequence.charAt(i);
|
|
StringBuilder sb = new StringBuilder(37);
|
|
sb.append("Failed writing ");
|
|
sb.append(charAt2);
|
|
sb.append(" at index ");
|
|
sb.append(position2);
|
|
throw new ArrayIndexOutOfBoundsException(sb.toString());
|
|
}
|
|
}
|
|
if (i == length) {
|
|
byteBuffer.position(position + i);
|
|
return;
|
|
}
|
|
position += i;
|
|
while (i < length) {
|
|
char charAt3 = charSequence.charAt(i);
|
|
if (charAt3 < 128) {
|
|
byteBuffer.put(position, (byte) charAt3);
|
|
} else if (charAt3 < 2048) {
|
|
int i2 = position + 1;
|
|
try {
|
|
byteBuffer.put(position, (byte) ((charAt3 >>> 6) | 192));
|
|
byteBuffer.put(i2, (byte) ((charAt3 & '?') | PeripheralType.SERVO));
|
|
position = i2;
|
|
} catch (IndexOutOfBoundsException unused2) {
|
|
position = i2;
|
|
int position22 = byteBuffer.position() + Math.max(i, (position - byteBuffer.position()) + 1);
|
|
char charAt22 = charSequence.charAt(i);
|
|
StringBuilder sb2 = new StringBuilder(37);
|
|
sb2.append("Failed writing ");
|
|
sb2.append(charAt22);
|
|
sb2.append(" at index ");
|
|
sb2.append(position22);
|
|
throw new ArrayIndexOutOfBoundsException(sb2.toString());
|
|
}
|
|
} else {
|
|
if (charAt3 >= 55296 && 57343 >= charAt3) {
|
|
int i3 = i + 1;
|
|
if (i3 != length) {
|
|
try {
|
|
char charAt4 = charSequence.charAt(i3);
|
|
if (Character.isSurrogatePair(charAt3, charAt4)) {
|
|
int codePoint = Character.toCodePoint(charAt3, charAt4);
|
|
int i4 = position + 1;
|
|
try {
|
|
byteBuffer.put(position, (byte) ((codePoint >>> 18) | 240));
|
|
int i5 = i4 + 1;
|
|
byteBuffer.put(i4, (byte) (((codePoint >>> 12) & 63) | PeripheralType.SERVO));
|
|
int i6 = i5 + 1;
|
|
byteBuffer.put(i5, (byte) (((codePoint >>> 6) & 63) | PeripheralType.SERVO));
|
|
byteBuffer.put(i6, (byte) ((codePoint & 63) | PeripheralType.SERVO));
|
|
position = i6;
|
|
i = i3;
|
|
} catch (IndexOutOfBoundsException unused3) {
|
|
position = i4;
|
|
i = i3;
|
|
int position222 = byteBuffer.position() + Math.max(i, (position - byteBuffer.position()) + 1);
|
|
char charAt222 = charSequence.charAt(i);
|
|
StringBuilder sb22 = new StringBuilder(37);
|
|
sb22.append("Failed writing ");
|
|
sb22.append(charAt222);
|
|
sb22.append(" at index ");
|
|
sb22.append(position222);
|
|
throw new ArrayIndexOutOfBoundsException(sb22.toString());
|
|
}
|
|
} else {
|
|
i = i3;
|
|
}
|
|
} catch (IndexOutOfBoundsException unused4) {
|
|
}
|
|
}
|
|
throw new zzxp(i, length);
|
|
}
|
|
int i7 = position + 1;
|
|
byteBuffer.put(position, (byte) ((charAt3 >>> '\f') | 224));
|
|
position = i7 + 1;
|
|
byteBuffer.put(i7, (byte) (((charAt3 >>> 6) & 63) | PeripheralType.SERVO));
|
|
byteBuffer.put(position, (byte) ((charAt3 & '?') | PeripheralType.SERVO));
|
|
}
|
|
i++;
|
|
position++;
|
|
}
|
|
byteBuffer.position(position);
|
|
}
|
|
|
|
abstract int a(int i, byte[] bArr, int i2, int i3);
|
|
|
|
abstract int a(CharSequence charSequence, byte[] bArr, int i, int i2);
|
|
|
|
abstract void a(CharSequence charSequence, ByteBuffer byteBuffer);
|
|
|
|
final boolean a(byte[] bArr, int i, int i2) {
|
|
return a(0, bArr, i, i2) == 0;
|
|
}
|
|
|
|
abstract String b(byte[] bArr, int i, int i2) throws zzuv;
|
|
}
|