ADD week 5
This commit is contained in:
@ -0,0 +1,225 @@
|
||||
package androidx.emoji2.text.flatbuffer;
|
||||
|
||||
import java.util.Arrays;
|
||||
import kotlin.UByte;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ArrayReadWriteBuf implements ReadWriteBuf {
|
||||
private byte[] buffer;
|
||||
private int writePos;
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadBuf
|
||||
public byte[] data() {
|
||||
return this.buffer;
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadWriteBuf, androidx.emoji2.text.flatbuffer.ReadBuf
|
||||
public int limit() {
|
||||
return this.writePos;
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadWriteBuf
|
||||
public int writePosition() {
|
||||
return this.writePos;
|
||||
}
|
||||
|
||||
public ArrayReadWriteBuf() {
|
||||
this(10);
|
||||
}
|
||||
|
||||
public ArrayReadWriteBuf(int i) {
|
||||
this(new byte[i]);
|
||||
}
|
||||
|
||||
public ArrayReadWriteBuf(byte[] bArr) {
|
||||
this.buffer = bArr;
|
||||
this.writePos = 0;
|
||||
}
|
||||
|
||||
public ArrayReadWriteBuf(byte[] bArr, int i) {
|
||||
this.buffer = bArr;
|
||||
this.writePos = i;
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadBuf
|
||||
public boolean getBoolean(int i) {
|
||||
return this.buffer[i] != 0;
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadBuf
|
||||
public byte get(int i) {
|
||||
return this.buffer[i];
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadBuf
|
||||
public short getShort(int i) {
|
||||
byte[] bArr = this.buffer;
|
||||
return (short) ((bArr[i] & UByte.MAX_VALUE) | (bArr[i + 1] << 8));
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadBuf
|
||||
public int getInt(int i) {
|
||||
byte[] bArr = this.buffer;
|
||||
return (bArr[i] & UByte.MAX_VALUE) | (bArr[i + 3] << 24) | ((bArr[i + 2] & UByte.MAX_VALUE) << 16) | ((bArr[i + 1] & UByte.MAX_VALUE) << 8);
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadBuf
|
||||
public long getLong(int i) {
|
||||
byte[] bArr = this.buffer;
|
||||
int i2 = i + 6;
|
||||
return (bArr[i] & 255) | ((bArr[i + 1] & 255) << 8) | ((bArr[i + 2] & 255) << 16) | ((bArr[i + 3] & 255) << 24) | ((bArr[i + 4] & 255) << 32) | ((bArr[i + 5] & 255) << 40) | ((bArr[i2] & 255) << 48) | (bArr[i + 7] << 56);
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadBuf
|
||||
public float getFloat(int i) {
|
||||
return Float.intBitsToFloat(getInt(i));
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadBuf
|
||||
public double getDouble(int i) {
|
||||
return Double.longBitsToDouble(getLong(i));
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadBuf
|
||||
public String getString(int i, int i2) {
|
||||
return Utf8Safe.decodeUtf8Array(this.buffer, i, i2);
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadWriteBuf
|
||||
public void putBoolean(boolean z) {
|
||||
setBoolean(this.writePos, z);
|
||||
this.writePos++;
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadWriteBuf
|
||||
public void put(byte[] bArr, int i, int i2) {
|
||||
set(this.writePos, bArr, i, i2);
|
||||
this.writePos += i2;
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadWriteBuf
|
||||
public void put(byte b) {
|
||||
set(this.writePos, b);
|
||||
this.writePos++;
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadWriteBuf
|
||||
public void putShort(short s) {
|
||||
setShort(this.writePos, s);
|
||||
this.writePos += 2;
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadWriteBuf
|
||||
public void putInt(int i) {
|
||||
setInt(this.writePos, i);
|
||||
this.writePos += 4;
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadWriteBuf
|
||||
public void putLong(long j) {
|
||||
setLong(this.writePos, j);
|
||||
this.writePos += 8;
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadWriteBuf
|
||||
public void putFloat(float f) {
|
||||
setFloat(this.writePos, f);
|
||||
this.writePos += 4;
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadWriteBuf
|
||||
public void putDouble(double d) {
|
||||
setDouble(this.writePos, d);
|
||||
this.writePos += 8;
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadWriteBuf
|
||||
public void setBoolean(int i, boolean z) {
|
||||
set(i, z ? (byte) 1 : (byte) 0);
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadWriteBuf
|
||||
public void set(int i, byte b) {
|
||||
requestCapacity(i + 1);
|
||||
this.buffer[i] = b;
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadWriteBuf
|
||||
public void set(int i, byte[] bArr, int i2, int i3) {
|
||||
requestCapacity((i3 - i2) + i);
|
||||
System.arraycopy(bArr, i2, this.buffer, i, i3);
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadWriteBuf
|
||||
public void setShort(int i, short s) {
|
||||
requestCapacity(i + 2);
|
||||
byte[] bArr = this.buffer;
|
||||
bArr[i] = (byte) (s & 255);
|
||||
bArr[i + 1] = (byte) ((s >> 8) & 255);
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadWriteBuf
|
||||
public void setInt(int i, int i2) {
|
||||
requestCapacity(i + 4);
|
||||
byte[] bArr = this.buffer;
|
||||
bArr[i] = (byte) (i2 & 255);
|
||||
bArr[i + 1] = (byte) ((i2 >> 8) & 255);
|
||||
bArr[i + 2] = (byte) ((i2 >> 16) & 255);
|
||||
bArr[i + 3] = (byte) ((i2 >> 24) & 255);
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadWriteBuf
|
||||
public void setLong(int i, long j) {
|
||||
requestCapacity(i + 8);
|
||||
int i2 = (int) j;
|
||||
byte[] bArr = this.buffer;
|
||||
bArr[i] = (byte) (i2 & 255);
|
||||
bArr[i + 1] = (byte) ((i2 >> 8) & 255);
|
||||
bArr[i + 2] = (byte) ((i2 >> 16) & 255);
|
||||
bArr[i + 3] = (byte) ((i2 >> 24) & 255);
|
||||
int i3 = (int) (j >> 32);
|
||||
bArr[i + 4] = (byte) (i3 & 255);
|
||||
bArr[i + 5] = (byte) ((i3 >> 8) & 255);
|
||||
bArr[i + 6] = (byte) ((i3 >> 16) & 255);
|
||||
bArr[i + 7] = (byte) ((i3 >> 24) & 255);
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadWriteBuf
|
||||
public void setFloat(int i, float f) {
|
||||
requestCapacity(i + 4);
|
||||
int floatToRawIntBits = Float.floatToRawIntBits(f);
|
||||
byte[] bArr = this.buffer;
|
||||
bArr[i] = (byte) (floatToRawIntBits & 255);
|
||||
bArr[i + 1] = (byte) ((floatToRawIntBits >> 8) & 255);
|
||||
bArr[i + 2] = (byte) ((floatToRawIntBits >> 16) & 255);
|
||||
bArr[i + 3] = (byte) ((floatToRawIntBits >> 24) & 255);
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadWriteBuf
|
||||
public void setDouble(int i, double d) {
|
||||
requestCapacity(i + 8);
|
||||
long doubleToRawLongBits = Double.doubleToRawLongBits(d);
|
||||
int i2 = (int) doubleToRawLongBits;
|
||||
byte[] bArr = this.buffer;
|
||||
bArr[i] = (byte) (i2 & 255);
|
||||
bArr[i + 1] = (byte) ((i2 >> 8) & 255);
|
||||
bArr[i + 2] = (byte) ((i2 >> 16) & 255);
|
||||
bArr[i + 3] = (byte) ((i2 >> 24) & 255);
|
||||
int i3 = (int) (doubleToRawLongBits >> 32);
|
||||
bArr[i + 4] = (byte) (i3 & 255);
|
||||
bArr[i + 5] = (byte) ((i3 >> 8) & 255);
|
||||
bArr[i + 6] = (byte) ((i3 >> 16) & 255);
|
||||
bArr[i + 7] = (byte) ((i3 >> 24) & 255);
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadWriteBuf
|
||||
public boolean requestCapacity(int i) {
|
||||
byte[] bArr = this.buffer;
|
||||
if (bArr.length > i) {
|
||||
return true;
|
||||
}
|
||||
int length = bArr.length;
|
||||
this.buffer = Arrays.copyOf(bArr, length + (length >> 1));
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package androidx.emoji2.text.flatbuffer;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class BaseVector {
|
||||
protected ByteBuffer bb;
|
||||
private int element_size;
|
||||
private int length;
|
||||
private int vector;
|
||||
|
||||
protected int __element(int i) {
|
||||
return this.vector + (i * this.element_size);
|
||||
}
|
||||
|
||||
protected int __vector() {
|
||||
return this.vector;
|
||||
}
|
||||
|
||||
public int length() {
|
||||
return this.length;
|
||||
}
|
||||
|
||||
protected void __reset(int i, int i2, ByteBuffer byteBuffer) {
|
||||
this.bb = byteBuffer;
|
||||
if (byteBuffer != null) {
|
||||
this.vector = i;
|
||||
this.length = byteBuffer.getInt(i - 4);
|
||||
this.element_size = i2;
|
||||
} else {
|
||||
this.vector = 0;
|
||||
this.length = 0;
|
||||
this.element_size = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
__reset(0, 0, null);
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package androidx.emoji2.text.flatbuffer;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class BooleanVector extends BaseVector {
|
||||
public BooleanVector __assign(int i, ByteBuffer byteBuffer) {
|
||||
__reset(i, 1, byteBuffer);
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean get(int i) {
|
||||
return this.bb.get(__element(i)) != 0;
|
||||
}
|
||||
}
|
@ -0,0 +1,164 @@
|
||||
package androidx.emoji2.text.flatbuffer;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ByteBufferReadWriteBuf implements ReadWriteBuf {
|
||||
private final ByteBuffer buffer;
|
||||
|
||||
public ByteBufferReadWriteBuf(ByteBuffer byteBuffer) {
|
||||
this.buffer = byteBuffer;
|
||||
byteBuffer.order(ByteOrder.LITTLE_ENDIAN);
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadBuf
|
||||
public boolean getBoolean(int i) {
|
||||
return get(i) != 0;
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadBuf
|
||||
public byte get(int i) {
|
||||
return this.buffer.get(i);
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadBuf
|
||||
public short getShort(int i) {
|
||||
return this.buffer.getShort(i);
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadBuf
|
||||
public int getInt(int i) {
|
||||
return this.buffer.getInt(i);
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadBuf
|
||||
public long getLong(int i) {
|
||||
return this.buffer.getLong(i);
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadBuf
|
||||
public float getFloat(int i) {
|
||||
return this.buffer.getFloat(i);
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadBuf
|
||||
public double getDouble(int i) {
|
||||
return this.buffer.getDouble(i);
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadBuf
|
||||
public String getString(int i, int i2) {
|
||||
return Utf8Safe.decodeUtf8Buffer(this.buffer, i, i2);
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadBuf
|
||||
public byte[] data() {
|
||||
return this.buffer.array();
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadWriteBuf
|
||||
public void putBoolean(boolean z) {
|
||||
this.buffer.put(z ? (byte) 1 : (byte) 0);
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadWriteBuf
|
||||
public void put(byte[] bArr, int i, int i2) {
|
||||
this.buffer.put(bArr, i, i2);
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadWriteBuf
|
||||
public void put(byte b) {
|
||||
this.buffer.put(b);
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadWriteBuf
|
||||
public void putShort(short s) {
|
||||
this.buffer.putShort(s);
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadWriteBuf
|
||||
public void putInt(int i) {
|
||||
this.buffer.putInt(i);
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadWriteBuf
|
||||
public void putLong(long j) {
|
||||
this.buffer.putLong(j);
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadWriteBuf
|
||||
public void putFloat(float f) {
|
||||
this.buffer.putFloat(f);
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadWriteBuf
|
||||
public void putDouble(double d) {
|
||||
this.buffer.putDouble(d);
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadWriteBuf
|
||||
public void setBoolean(int i, boolean z) {
|
||||
set(i, z ? (byte) 1 : (byte) 0);
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadWriteBuf
|
||||
public void set(int i, byte b) {
|
||||
requestCapacity(i + 1);
|
||||
this.buffer.put(i, b);
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadWriteBuf
|
||||
public void set(int i, byte[] bArr, int i2, int i3) {
|
||||
requestCapacity((i3 - i2) + i);
|
||||
int position = this.buffer.position();
|
||||
this.buffer.position(i);
|
||||
this.buffer.put(bArr, i2, i3);
|
||||
this.buffer.position(position);
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadWriteBuf
|
||||
public void setShort(int i, short s) {
|
||||
requestCapacity(i + 2);
|
||||
this.buffer.putShort(i, s);
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadWriteBuf
|
||||
public void setInt(int i, int i2) {
|
||||
requestCapacity(i + 4);
|
||||
this.buffer.putInt(i, i2);
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadWriteBuf
|
||||
public void setLong(int i, long j) {
|
||||
requestCapacity(i + 8);
|
||||
this.buffer.putLong(i, j);
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadWriteBuf
|
||||
public void setFloat(int i, float f) {
|
||||
requestCapacity(i + 4);
|
||||
this.buffer.putFloat(i, f);
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadWriteBuf
|
||||
public void setDouble(int i, double d) {
|
||||
requestCapacity(i + 8);
|
||||
this.buffer.putDouble(i, d);
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadWriteBuf
|
||||
public int writePosition() {
|
||||
return this.buffer.position();
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadWriteBuf, androidx.emoji2.text.flatbuffer.ReadBuf
|
||||
public int limit() {
|
||||
return this.buffer.limit();
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadWriteBuf
|
||||
public boolean requestCapacity(int i) {
|
||||
return i <= this.buffer.limit();
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package androidx.emoji2.text.flatbuffer;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ByteBufferUtil {
|
||||
public static int getSizePrefix(ByteBuffer byteBuffer) {
|
||||
return byteBuffer.getInt(byteBuffer.position());
|
||||
}
|
||||
|
||||
public static ByteBuffer removeSizePrefix(ByteBuffer byteBuffer) {
|
||||
ByteBuffer duplicate = byteBuffer.duplicate();
|
||||
duplicate.position(duplicate.position() + 4);
|
||||
return duplicate;
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package androidx.emoji2.text.flatbuffer;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import kotlin.UByte;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class ByteVector extends BaseVector {
|
||||
public ByteVector __assign(int i, ByteBuffer byteBuffer) {
|
||||
__reset(i, 1, byteBuffer);
|
||||
return this;
|
||||
}
|
||||
|
||||
public byte get(int i) {
|
||||
return this.bb.get(__element(i));
|
||||
}
|
||||
|
||||
public int getAsUnsigned(int i) {
|
||||
return get(i) & UByte.MAX_VALUE;
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package androidx.emoji2.text.flatbuffer;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class Constants {
|
||||
static final int FILE_IDENTIFIER_LENGTH = 4;
|
||||
static final int SIZEOF_BYTE = 1;
|
||||
static final int SIZEOF_DOUBLE = 8;
|
||||
static final int SIZEOF_FLOAT = 4;
|
||||
static final int SIZEOF_INT = 4;
|
||||
static final int SIZEOF_LONG = 8;
|
||||
static final int SIZEOF_SHORT = 2;
|
||||
public static final int SIZE_PREFIX_LENGTH = 4;
|
||||
|
||||
public static void FLATBUFFERS_1_12_0() {
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package androidx.emoji2.text.flatbuffer;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class DoubleVector extends BaseVector {
|
||||
public DoubleVector __assign(int i, ByteBuffer byteBuffer) {
|
||||
__reset(i, 8, byteBuffer);
|
||||
return this;
|
||||
}
|
||||
|
||||
public double get(int i) {
|
||||
return this.bb.getDouble(__element(i));
|
||||
}
|
||||
}
|
@ -0,0 +1,615 @@
|
||||
package androidx.emoji2.text.flatbuffer;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.BufferUnderflowException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.util.Arrays;
|
||||
import kotlin.UByte;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class FlatBufferBuilder {
|
||||
static final /* synthetic */ boolean $assertionsDisabled = false;
|
||||
ByteBuffer bb;
|
||||
ByteBufferFactory bb_factory;
|
||||
boolean finished;
|
||||
boolean force_defaults;
|
||||
int minalign;
|
||||
boolean nested;
|
||||
int num_vtables;
|
||||
int object_start;
|
||||
int space;
|
||||
final Utf8 utf8;
|
||||
int vector_num_elems;
|
||||
int[] vtable;
|
||||
int vtable_in_use;
|
||||
int[] vtables;
|
||||
|
||||
public static abstract class ByteBufferFactory {
|
||||
public abstract ByteBuffer newByteBuffer(int i);
|
||||
|
||||
public void releaseByteBuffer(ByteBuffer byteBuffer) {
|
||||
}
|
||||
}
|
||||
|
||||
public FlatBufferBuilder forceDefaults(boolean z) {
|
||||
this.force_defaults = z;
|
||||
return this;
|
||||
}
|
||||
|
||||
public FlatBufferBuilder(int i, ByteBufferFactory byteBufferFactory) {
|
||||
this(i, byteBufferFactory, null, Utf8.getDefault());
|
||||
}
|
||||
|
||||
public FlatBufferBuilder(int i, ByteBufferFactory byteBufferFactory, ByteBuffer byteBuffer, Utf8 utf8) {
|
||||
this.minalign = 1;
|
||||
this.vtable = null;
|
||||
this.vtable_in_use = 0;
|
||||
this.nested = false;
|
||||
this.finished = false;
|
||||
this.vtables = new int[16];
|
||||
this.num_vtables = 0;
|
||||
this.vector_num_elems = 0;
|
||||
this.force_defaults = false;
|
||||
i = i <= 0 ? 1 : i;
|
||||
this.bb_factory = byteBufferFactory;
|
||||
if (byteBuffer != null) {
|
||||
this.bb = byteBuffer;
|
||||
byteBuffer.clear();
|
||||
this.bb.order(ByteOrder.LITTLE_ENDIAN);
|
||||
} else {
|
||||
this.bb = byteBufferFactory.newByteBuffer(i);
|
||||
}
|
||||
this.utf8 = utf8;
|
||||
this.space = this.bb.capacity();
|
||||
}
|
||||
|
||||
public FlatBufferBuilder(int i) {
|
||||
this(i, HeapByteBufferFactory.INSTANCE, null, Utf8.getDefault());
|
||||
}
|
||||
|
||||
public FlatBufferBuilder() {
|
||||
this(1024);
|
||||
}
|
||||
|
||||
public FlatBufferBuilder(ByteBuffer byteBuffer, ByteBufferFactory byteBufferFactory) {
|
||||
this(byteBuffer.capacity(), byteBufferFactory, byteBuffer, Utf8.getDefault());
|
||||
}
|
||||
|
||||
public FlatBufferBuilder(ByteBuffer byteBuffer) {
|
||||
this(byteBuffer, new HeapByteBufferFactory());
|
||||
}
|
||||
|
||||
public FlatBufferBuilder init(ByteBuffer byteBuffer, ByteBufferFactory byteBufferFactory) {
|
||||
this.bb_factory = byteBufferFactory;
|
||||
this.bb = byteBuffer;
|
||||
byteBuffer.clear();
|
||||
this.bb.order(ByteOrder.LITTLE_ENDIAN);
|
||||
this.minalign = 1;
|
||||
this.space = this.bb.capacity();
|
||||
this.vtable_in_use = 0;
|
||||
this.nested = false;
|
||||
this.finished = false;
|
||||
this.object_start = 0;
|
||||
this.num_vtables = 0;
|
||||
this.vector_num_elems = 0;
|
||||
return this;
|
||||
}
|
||||
|
||||
public static final class HeapByteBufferFactory extends ByteBufferFactory {
|
||||
public static final HeapByteBufferFactory INSTANCE = new HeapByteBufferFactory();
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.FlatBufferBuilder.ByteBufferFactory
|
||||
public ByteBuffer newByteBuffer(int i) {
|
||||
return ByteBuffer.allocate(i).order(ByteOrder.LITTLE_ENDIAN);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isFieldPresent(Table table, int i) {
|
||||
return table.__offset(i) != 0;
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
this.space = this.bb.capacity();
|
||||
this.bb.clear();
|
||||
this.minalign = 1;
|
||||
while (true) {
|
||||
int i = this.vtable_in_use;
|
||||
if (i <= 0) {
|
||||
this.vtable_in_use = 0;
|
||||
this.nested = false;
|
||||
this.finished = false;
|
||||
this.object_start = 0;
|
||||
this.num_vtables = 0;
|
||||
this.vector_num_elems = 0;
|
||||
return;
|
||||
}
|
||||
int[] iArr = this.vtable;
|
||||
int i2 = i - 1;
|
||||
this.vtable_in_use = i2;
|
||||
iArr[i2] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static ByteBuffer growByteBuffer(ByteBuffer byteBuffer, ByteBufferFactory byteBufferFactory) {
|
||||
int capacity = byteBuffer.capacity();
|
||||
if (((-1073741824) & capacity) != 0) {
|
||||
throw new AssertionError("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");
|
||||
}
|
||||
int i = capacity == 0 ? 1 : capacity << 1;
|
||||
byteBuffer.position(0);
|
||||
ByteBuffer newByteBuffer = byteBufferFactory.newByteBuffer(i);
|
||||
newByteBuffer.position(newByteBuffer.clear().capacity() - capacity);
|
||||
newByteBuffer.put(byteBuffer);
|
||||
return newByteBuffer;
|
||||
}
|
||||
|
||||
public int offset() {
|
||||
return this.bb.capacity() - this.space;
|
||||
}
|
||||
|
||||
public void pad(int i) {
|
||||
for (int i2 = 0; i2 < i; i2++) {
|
||||
ByteBuffer byteBuffer = this.bb;
|
||||
int i3 = this.space - 1;
|
||||
this.space = i3;
|
||||
byteBuffer.put(i3, (byte) 0);
|
||||
}
|
||||
}
|
||||
|
||||
public void prep(int i, int i2) {
|
||||
if (i > this.minalign) {
|
||||
this.minalign = i;
|
||||
}
|
||||
int i3 = ((~((this.bb.capacity() - this.space) + i2)) + 1) & (i - 1);
|
||||
while (this.space < i3 + i + i2) {
|
||||
int capacity = this.bb.capacity();
|
||||
ByteBuffer byteBuffer = this.bb;
|
||||
ByteBuffer growByteBuffer = growByteBuffer(byteBuffer, this.bb_factory);
|
||||
this.bb = growByteBuffer;
|
||||
if (byteBuffer != growByteBuffer) {
|
||||
this.bb_factory.releaseByteBuffer(byteBuffer);
|
||||
}
|
||||
this.space += this.bb.capacity() - capacity;
|
||||
}
|
||||
pad(i3);
|
||||
}
|
||||
|
||||
public void putBoolean(boolean z) {
|
||||
ByteBuffer byteBuffer = this.bb;
|
||||
int i = this.space - 1;
|
||||
this.space = i;
|
||||
byteBuffer.put(i, z ? (byte) 1 : (byte) 0);
|
||||
}
|
||||
|
||||
public void putByte(byte b) {
|
||||
ByteBuffer byteBuffer = this.bb;
|
||||
int i = this.space - 1;
|
||||
this.space = i;
|
||||
byteBuffer.put(i, b);
|
||||
}
|
||||
|
||||
public void putShort(short s) {
|
||||
ByteBuffer byteBuffer = this.bb;
|
||||
int i = this.space - 2;
|
||||
this.space = i;
|
||||
byteBuffer.putShort(i, s);
|
||||
}
|
||||
|
||||
public void putInt(int i) {
|
||||
ByteBuffer byteBuffer = this.bb;
|
||||
int i2 = this.space - 4;
|
||||
this.space = i2;
|
||||
byteBuffer.putInt(i2, i);
|
||||
}
|
||||
|
||||
public void putLong(long j) {
|
||||
ByteBuffer byteBuffer = this.bb;
|
||||
int i = this.space - 8;
|
||||
this.space = i;
|
||||
byteBuffer.putLong(i, j);
|
||||
}
|
||||
|
||||
public void putFloat(float f) {
|
||||
ByteBuffer byteBuffer = this.bb;
|
||||
int i = this.space - 4;
|
||||
this.space = i;
|
||||
byteBuffer.putFloat(i, f);
|
||||
}
|
||||
|
||||
public void putDouble(double d) {
|
||||
ByteBuffer byteBuffer = this.bb;
|
||||
int i = this.space - 8;
|
||||
this.space = i;
|
||||
byteBuffer.putDouble(i, d);
|
||||
}
|
||||
|
||||
public void addBoolean(boolean z) {
|
||||
prep(1, 0);
|
||||
putBoolean(z);
|
||||
}
|
||||
|
||||
public void addByte(byte b) {
|
||||
prep(1, 0);
|
||||
putByte(b);
|
||||
}
|
||||
|
||||
public void addShort(short s) {
|
||||
prep(2, 0);
|
||||
putShort(s);
|
||||
}
|
||||
|
||||
public void addInt(int i) {
|
||||
prep(4, 0);
|
||||
putInt(i);
|
||||
}
|
||||
|
||||
public void addLong(long j) {
|
||||
prep(8, 0);
|
||||
putLong(j);
|
||||
}
|
||||
|
||||
public void addFloat(float f) {
|
||||
prep(4, 0);
|
||||
putFloat(f);
|
||||
}
|
||||
|
||||
public void addDouble(double d) {
|
||||
prep(8, 0);
|
||||
putDouble(d);
|
||||
}
|
||||
|
||||
public void addOffset(int i) {
|
||||
prep(4, 0);
|
||||
putInt((offset() - i) + 4);
|
||||
}
|
||||
|
||||
public void startVector(int i, int i2, int i3) {
|
||||
notNested();
|
||||
this.vector_num_elems = i2;
|
||||
int i4 = i * i2;
|
||||
prep(4, i4);
|
||||
prep(i3, i4);
|
||||
this.nested = true;
|
||||
}
|
||||
|
||||
public int endVector() {
|
||||
if (!this.nested) {
|
||||
throw new AssertionError("FlatBuffers: endVector called without startVector");
|
||||
}
|
||||
this.nested = false;
|
||||
putInt(this.vector_num_elems);
|
||||
return offset();
|
||||
}
|
||||
|
||||
public ByteBuffer createUnintializedVector(int i, int i2, int i3) {
|
||||
int i4 = i * i2;
|
||||
startVector(i, i2, i3);
|
||||
ByteBuffer byteBuffer = this.bb;
|
||||
int i5 = this.space - i4;
|
||||
this.space = i5;
|
||||
byteBuffer.position(i5);
|
||||
ByteBuffer order = this.bb.slice().order(ByteOrder.LITTLE_ENDIAN);
|
||||
order.limit(i4);
|
||||
return order;
|
||||
}
|
||||
|
||||
public int createVectorOfTables(int[] iArr) {
|
||||
notNested();
|
||||
startVector(4, iArr.length, 4);
|
||||
for (int length = iArr.length - 1; length >= 0; length--) {
|
||||
addOffset(iArr[length]);
|
||||
}
|
||||
return endVector();
|
||||
}
|
||||
|
||||
public <T extends Table> int createSortedVectorOfTables(T t, int[] iArr) {
|
||||
t.sortTables(iArr, this.bb);
|
||||
return createVectorOfTables(iArr);
|
||||
}
|
||||
|
||||
public int createString(CharSequence charSequence) {
|
||||
int encodedLength = this.utf8.encodedLength(charSequence);
|
||||
addByte((byte) 0);
|
||||
startVector(1, encodedLength, 1);
|
||||
ByteBuffer byteBuffer = this.bb;
|
||||
int i = this.space - encodedLength;
|
||||
this.space = i;
|
||||
byteBuffer.position(i);
|
||||
this.utf8.encodeUtf8(charSequence, this.bb);
|
||||
return endVector();
|
||||
}
|
||||
|
||||
public int createString(ByteBuffer byteBuffer) {
|
||||
int remaining = byteBuffer.remaining();
|
||||
addByte((byte) 0);
|
||||
startVector(1, remaining, 1);
|
||||
ByteBuffer byteBuffer2 = this.bb;
|
||||
int i = this.space - remaining;
|
||||
this.space = i;
|
||||
byteBuffer2.position(i);
|
||||
this.bb.put(byteBuffer);
|
||||
return endVector();
|
||||
}
|
||||
|
||||
public int createByteVector(byte[] bArr) {
|
||||
int length = bArr.length;
|
||||
startVector(1, length, 1);
|
||||
ByteBuffer byteBuffer = this.bb;
|
||||
int i = this.space - length;
|
||||
this.space = i;
|
||||
byteBuffer.position(i);
|
||||
this.bb.put(bArr);
|
||||
return endVector();
|
||||
}
|
||||
|
||||
public int createByteVector(byte[] bArr, int i, int i2) {
|
||||
startVector(1, i2, 1);
|
||||
ByteBuffer byteBuffer = this.bb;
|
||||
int i3 = this.space - i2;
|
||||
this.space = i3;
|
||||
byteBuffer.position(i3);
|
||||
this.bb.put(bArr, i, i2);
|
||||
return endVector();
|
||||
}
|
||||
|
||||
public int createByteVector(ByteBuffer byteBuffer) {
|
||||
int remaining = byteBuffer.remaining();
|
||||
startVector(1, remaining, 1);
|
||||
ByteBuffer byteBuffer2 = this.bb;
|
||||
int i = this.space - remaining;
|
||||
this.space = i;
|
||||
byteBuffer2.position(i);
|
||||
this.bb.put(byteBuffer);
|
||||
return endVector();
|
||||
}
|
||||
|
||||
public void finished() {
|
||||
if (!this.finished) {
|
||||
throw new AssertionError("FlatBuffers: you can only access the serialized buffer after it has been finished by FlatBufferBuilder.finish().");
|
||||
}
|
||||
}
|
||||
|
||||
public void notNested() {
|
||||
if (this.nested) {
|
||||
throw new AssertionError("FlatBuffers: object serialization must not be nested.");
|
||||
}
|
||||
}
|
||||
|
||||
public void Nested(int i) {
|
||||
if (i != offset()) {
|
||||
throw new AssertionError("FlatBuffers: struct must be serialized inline.");
|
||||
}
|
||||
}
|
||||
|
||||
public void startTable(int i) {
|
||||
notNested();
|
||||
int[] iArr = this.vtable;
|
||||
if (iArr == null || iArr.length < i) {
|
||||
this.vtable = new int[i];
|
||||
}
|
||||
this.vtable_in_use = i;
|
||||
Arrays.fill(this.vtable, 0, i, 0);
|
||||
this.nested = true;
|
||||
this.object_start = offset();
|
||||
}
|
||||
|
||||
public void addBoolean(int i, boolean z, boolean z2) {
|
||||
if (this.force_defaults || z != z2) {
|
||||
addBoolean(z);
|
||||
slot(i);
|
||||
}
|
||||
}
|
||||
|
||||
public void addByte(int i, byte b, int i2) {
|
||||
if (this.force_defaults || b != i2) {
|
||||
addByte(b);
|
||||
slot(i);
|
||||
}
|
||||
}
|
||||
|
||||
public void addShort(int i, short s, int i2) {
|
||||
if (this.force_defaults || s != i2) {
|
||||
addShort(s);
|
||||
slot(i);
|
||||
}
|
||||
}
|
||||
|
||||
public void addInt(int i, int i2, int i3) {
|
||||
if (this.force_defaults || i2 != i3) {
|
||||
addInt(i2);
|
||||
slot(i);
|
||||
}
|
||||
}
|
||||
|
||||
public void addLong(int i, long j, long j2) {
|
||||
if (this.force_defaults || j != j2) {
|
||||
addLong(j);
|
||||
slot(i);
|
||||
}
|
||||
}
|
||||
|
||||
public void addFloat(int i, float f, double d) {
|
||||
if (this.force_defaults || f != d) {
|
||||
addFloat(f);
|
||||
slot(i);
|
||||
}
|
||||
}
|
||||
|
||||
public void addDouble(int i, double d, double d2) {
|
||||
if (this.force_defaults || d != d2) {
|
||||
addDouble(d);
|
||||
slot(i);
|
||||
}
|
||||
}
|
||||
|
||||
public void addOffset(int i, int i2, int i3) {
|
||||
if (this.force_defaults || i2 != i3) {
|
||||
addOffset(i2);
|
||||
slot(i);
|
||||
}
|
||||
}
|
||||
|
||||
public void addStruct(int i, int i2, int i3) {
|
||||
if (i2 != i3) {
|
||||
Nested(i2);
|
||||
slot(i);
|
||||
}
|
||||
}
|
||||
|
||||
public void slot(int i) {
|
||||
this.vtable[i] = offset();
|
||||
}
|
||||
|
||||
public int endTable() {
|
||||
int i;
|
||||
if (this.vtable == null || !this.nested) {
|
||||
throw new AssertionError("FlatBuffers: endTable called without startTable");
|
||||
}
|
||||
addInt(0);
|
||||
int offset = offset();
|
||||
int i2 = this.vtable_in_use - 1;
|
||||
while (i2 >= 0 && this.vtable[i2] == 0) {
|
||||
i2--;
|
||||
}
|
||||
for (int i3 = i2; i3 >= 0; i3--) {
|
||||
int i4 = this.vtable[i3];
|
||||
addShort((short) (i4 != 0 ? offset - i4 : 0));
|
||||
}
|
||||
addShort((short) (offset - this.object_start));
|
||||
addShort((short) ((i2 + 3) * 2));
|
||||
int i5 = 0;
|
||||
loop2: while (true) {
|
||||
if (i5 >= this.num_vtables) {
|
||||
i = 0;
|
||||
break;
|
||||
}
|
||||
int capacity = this.bb.capacity() - this.vtables[i5];
|
||||
int i6 = this.space;
|
||||
short s = this.bb.getShort(capacity);
|
||||
if (s == this.bb.getShort(i6)) {
|
||||
for (int i7 = 2; i7 < s; i7 += 2) {
|
||||
if (this.bb.getShort(capacity + i7) != this.bb.getShort(i6 + i7)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
i = this.vtables[i5];
|
||||
break loop2;
|
||||
}
|
||||
i5++;
|
||||
}
|
||||
if (i != 0) {
|
||||
int capacity2 = this.bb.capacity() - offset;
|
||||
this.space = capacity2;
|
||||
this.bb.putInt(capacity2, i - offset);
|
||||
} else {
|
||||
int i8 = this.num_vtables;
|
||||
int[] iArr = this.vtables;
|
||||
if (i8 == iArr.length) {
|
||||
this.vtables = Arrays.copyOf(iArr, i8 * 2);
|
||||
}
|
||||
int[] iArr2 = this.vtables;
|
||||
int i9 = this.num_vtables;
|
||||
this.num_vtables = i9 + 1;
|
||||
iArr2[i9] = offset();
|
||||
ByteBuffer byteBuffer = this.bb;
|
||||
byteBuffer.putInt(byteBuffer.capacity() - offset, offset() - offset);
|
||||
}
|
||||
this.nested = false;
|
||||
return offset;
|
||||
}
|
||||
|
||||
public void required(int i, int i2) {
|
||||
int capacity = this.bb.capacity() - i;
|
||||
if (this.bb.getShort((capacity - this.bb.getInt(capacity)) + i2) != 0) {
|
||||
return;
|
||||
}
|
||||
throw new AssertionError("FlatBuffers: field " + i2 + " must be set");
|
||||
}
|
||||
|
||||
protected void finish(int i, boolean z) {
|
||||
prep(this.minalign, (z ? 4 : 0) + 4);
|
||||
addOffset(i);
|
||||
if (z) {
|
||||
addInt(this.bb.capacity() - this.space);
|
||||
}
|
||||
this.bb.position(this.space);
|
||||
this.finished = true;
|
||||
}
|
||||
|
||||
public void finish(int i) {
|
||||
finish(i, false);
|
||||
}
|
||||
|
||||
public void finishSizePrefixed(int i) {
|
||||
finish(i, true);
|
||||
}
|
||||
|
||||
protected void finish(int i, String str, boolean z) {
|
||||
prep(this.minalign, (z ? 4 : 0) + 8);
|
||||
if (str.length() != 4) {
|
||||
throw new AssertionError("FlatBuffers: file identifier must be length 4");
|
||||
}
|
||||
for (int i2 = 3; i2 >= 0; i2--) {
|
||||
addByte((byte) str.charAt(i2));
|
||||
}
|
||||
finish(i, z);
|
||||
}
|
||||
|
||||
public void finish(int i, String str) {
|
||||
finish(i, str, false);
|
||||
}
|
||||
|
||||
public void finishSizePrefixed(int i, String str) {
|
||||
finish(i, str, true);
|
||||
}
|
||||
|
||||
public ByteBuffer dataBuffer() {
|
||||
finished();
|
||||
return this.bb;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
private int dataStart() {
|
||||
finished();
|
||||
return this.space;
|
||||
}
|
||||
|
||||
public byte[] sizedByteArray(int i, int i2) {
|
||||
finished();
|
||||
byte[] bArr = new byte[i2];
|
||||
this.bb.position(i);
|
||||
this.bb.get(bArr);
|
||||
return bArr;
|
||||
}
|
||||
|
||||
public byte[] sizedByteArray() {
|
||||
return sizedByteArray(this.space, this.bb.capacity() - this.space);
|
||||
}
|
||||
|
||||
public InputStream sizedInputStream() {
|
||||
finished();
|
||||
ByteBuffer duplicate = this.bb.duplicate();
|
||||
duplicate.position(this.space);
|
||||
duplicate.limit(this.bb.capacity());
|
||||
return new ByteBufferBackedInputStream(duplicate);
|
||||
}
|
||||
|
||||
static class ByteBufferBackedInputStream extends InputStream {
|
||||
ByteBuffer buf;
|
||||
|
||||
public ByteBufferBackedInputStream(ByteBuffer byteBuffer) {
|
||||
this.buf = byteBuffer;
|
||||
}
|
||||
|
||||
@Override // java.io.InputStream
|
||||
public int read() throws IOException {
|
||||
try {
|
||||
return this.buf.get() & UByte.MAX_VALUE;
|
||||
} catch (BufferUnderflowException unused) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,846 @@
|
||||
package androidx.emoji2.text.flatbuffer;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import kotlin.UByte;
|
||||
import kotlin.UShort;
|
||||
import kotlin.text.Typography;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class FlexBuffers {
|
||||
static final /* synthetic */ boolean $assertionsDisabled = false;
|
||||
private static final ReadBuf EMPTY_BB = new ArrayReadWriteBuf(new byte[]{0}, 1);
|
||||
public static final int FBT_BLOB = 25;
|
||||
public static final int FBT_BOOL = 26;
|
||||
public static final int FBT_FLOAT = 3;
|
||||
public static final int FBT_INDIRECT_FLOAT = 8;
|
||||
public static final int FBT_INDIRECT_INT = 6;
|
||||
public static final int FBT_INDIRECT_UINT = 7;
|
||||
public static final int FBT_INT = 1;
|
||||
public static final int FBT_KEY = 4;
|
||||
public static final int FBT_MAP = 9;
|
||||
public static final int FBT_NULL = 0;
|
||||
public static final int FBT_STRING = 5;
|
||||
public static final int FBT_UINT = 2;
|
||||
public static final int FBT_VECTOR = 10;
|
||||
public static final int FBT_VECTOR_BOOL = 36;
|
||||
public static final int FBT_VECTOR_FLOAT = 13;
|
||||
public static final int FBT_VECTOR_FLOAT2 = 18;
|
||||
public static final int FBT_VECTOR_FLOAT3 = 21;
|
||||
public static final int FBT_VECTOR_FLOAT4 = 24;
|
||||
public static final int FBT_VECTOR_INT = 11;
|
||||
public static final int FBT_VECTOR_INT2 = 16;
|
||||
public static final int FBT_VECTOR_INT3 = 19;
|
||||
public static final int FBT_VECTOR_INT4 = 22;
|
||||
public static final int FBT_VECTOR_KEY = 14;
|
||||
public static final int FBT_VECTOR_STRING_DEPRECATED = 15;
|
||||
public static final int FBT_VECTOR_UINT = 12;
|
||||
public static final int FBT_VECTOR_UINT2 = 17;
|
||||
public static final int FBT_VECTOR_UINT3 = 20;
|
||||
public static final int FBT_VECTOR_UINT4 = 23;
|
||||
|
||||
static boolean isTypeInline(int i) {
|
||||
return i <= 3 || i == 26;
|
||||
}
|
||||
|
||||
static boolean isTypedVector(int i) {
|
||||
return (i >= 11 && i <= 15) || i == 36;
|
||||
}
|
||||
|
||||
static boolean isTypedVectorElementType(int i) {
|
||||
return (i >= 1 && i <= 4) || i == 26;
|
||||
}
|
||||
|
||||
static int toTypedVector(int i, int i2) {
|
||||
if (i2 == 0) {
|
||||
return i + 10;
|
||||
}
|
||||
if (i2 == 2) {
|
||||
return i + 15;
|
||||
}
|
||||
if (i2 == 3) {
|
||||
return i + 18;
|
||||
}
|
||||
if (i2 != 4) {
|
||||
return 0;
|
||||
}
|
||||
return i + 21;
|
||||
}
|
||||
|
||||
static int toTypedVectorElementType(int i) {
|
||||
return i - 10;
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public static int indirect(ReadBuf readBuf, int i, int i2) {
|
||||
return (int) (i - readUInt(readBuf, i, i2));
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public static long readUInt(ReadBuf readBuf, int i, int i2) {
|
||||
if (i2 == 1) {
|
||||
return Unsigned.byteToUnsignedInt(readBuf.get(i));
|
||||
}
|
||||
if (i2 == 2) {
|
||||
return Unsigned.shortToUnsignedInt(readBuf.getShort(i));
|
||||
}
|
||||
if (i2 == 4) {
|
||||
return Unsigned.intToUnsignedLong(readBuf.getInt(i));
|
||||
}
|
||||
if (i2 != 8) {
|
||||
return -1L;
|
||||
}
|
||||
return readBuf.getLong(i);
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public static int readInt(ReadBuf readBuf, int i, int i2) {
|
||||
return (int) readLong(readBuf, i, i2);
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public static long readLong(ReadBuf readBuf, int i, int i2) {
|
||||
int i3;
|
||||
if (i2 == 1) {
|
||||
i3 = readBuf.get(i);
|
||||
} else if (i2 == 2) {
|
||||
i3 = readBuf.getShort(i);
|
||||
} else {
|
||||
if (i2 != 4) {
|
||||
if (i2 != 8) {
|
||||
return -1L;
|
||||
}
|
||||
return readBuf.getLong(i);
|
||||
}
|
||||
i3 = readBuf.getInt(i);
|
||||
}
|
||||
return i3;
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public static double readDouble(ReadBuf readBuf, int i, int i2) {
|
||||
if (i2 == 4) {
|
||||
return readBuf.getFloat(i);
|
||||
}
|
||||
if (i2 != 8) {
|
||||
return -1.0d;
|
||||
}
|
||||
return readBuf.getDouble(i);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static Reference getRoot(ByteBuffer byteBuffer) {
|
||||
return getRoot(byteBuffer.hasArray() ? new ArrayReadWriteBuf(byteBuffer.array(), byteBuffer.limit()) : new ByteBufferReadWriteBuf(byteBuffer));
|
||||
}
|
||||
|
||||
public static Reference getRoot(ReadBuf readBuf) {
|
||||
int limit = readBuf.limit();
|
||||
byte b = readBuf.get(limit - 1);
|
||||
int i = limit - 2;
|
||||
return new Reference(readBuf, i - b, b, Unsigned.byteToUnsignedInt(readBuf.get(i)));
|
||||
}
|
||||
|
||||
public static class Reference {
|
||||
private static final Reference NULL_REFERENCE = new Reference(FlexBuffers.EMPTY_BB, 0, 1, 0);
|
||||
private ReadBuf bb;
|
||||
private int byteWidth;
|
||||
private int end;
|
||||
private int parentWidth;
|
||||
private int type;
|
||||
|
||||
public int getType() {
|
||||
return this.type;
|
||||
}
|
||||
|
||||
public boolean isBlob() {
|
||||
return this.type == 25;
|
||||
}
|
||||
|
||||
public boolean isBoolean() {
|
||||
return this.type == 26;
|
||||
}
|
||||
|
||||
public boolean isFloat() {
|
||||
int i = this.type;
|
||||
return i == 3 || i == 8;
|
||||
}
|
||||
|
||||
public boolean isInt() {
|
||||
int i = this.type;
|
||||
return i == 1 || i == 6;
|
||||
}
|
||||
|
||||
public boolean isKey() {
|
||||
return this.type == 4;
|
||||
}
|
||||
|
||||
public boolean isMap() {
|
||||
return this.type == 9;
|
||||
}
|
||||
|
||||
public boolean isNull() {
|
||||
return this.type == 0;
|
||||
}
|
||||
|
||||
public boolean isString() {
|
||||
return this.type == 5;
|
||||
}
|
||||
|
||||
public boolean isUInt() {
|
||||
int i = this.type;
|
||||
return i == 2 || i == 7;
|
||||
}
|
||||
|
||||
public boolean isVector() {
|
||||
int i = this.type;
|
||||
return i == 10 || i == 9;
|
||||
}
|
||||
|
||||
Reference(ReadBuf readBuf, int i, int i2, int i3) {
|
||||
this(readBuf, i, i2, 1 << (i3 & 3), i3 >> 2);
|
||||
}
|
||||
|
||||
Reference(ReadBuf readBuf, int i, int i2, int i3, int i4) {
|
||||
this.bb = readBuf;
|
||||
this.end = i;
|
||||
this.parentWidth = i2;
|
||||
this.byteWidth = i3;
|
||||
this.type = i4;
|
||||
}
|
||||
|
||||
public boolean isNumeric() {
|
||||
return isIntOrUInt() || isFloat();
|
||||
}
|
||||
|
||||
public boolean isIntOrUInt() {
|
||||
return isInt() || isUInt();
|
||||
}
|
||||
|
||||
public boolean isTypedVector() {
|
||||
return FlexBuffers.isTypedVector(this.type);
|
||||
}
|
||||
|
||||
public int asInt() {
|
||||
long readUInt;
|
||||
int i = this.type;
|
||||
if (i == 1) {
|
||||
return FlexBuffers.readInt(this.bb, this.end, this.parentWidth);
|
||||
}
|
||||
if (i == 2) {
|
||||
readUInt = FlexBuffers.readUInt(this.bb, this.end, this.parentWidth);
|
||||
} else {
|
||||
if (i == 3) {
|
||||
return (int) FlexBuffers.readDouble(this.bb, this.end, this.parentWidth);
|
||||
}
|
||||
if (i == 5) {
|
||||
return Integer.parseInt(asString());
|
||||
}
|
||||
if (i == 6) {
|
||||
ReadBuf readBuf = this.bb;
|
||||
return FlexBuffers.readInt(readBuf, FlexBuffers.indirect(readBuf, this.end, this.parentWidth), this.byteWidth);
|
||||
}
|
||||
if (i != 7) {
|
||||
if (i == 8) {
|
||||
ReadBuf readBuf2 = this.bb;
|
||||
return (int) FlexBuffers.readDouble(readBuf2, FlexBuffers.indirect(readBuf2, this.end, this.parentWidth), this.byteWidth);
|
||||
}
|
||||
if (i == 10) {
|
||||
return asVector().size();
|
||||
}
|
||||
if (i != 26) {
|
||||
return 0;
|
||||
}
|
||||
return FlexBuffers.readInt(this.bb, this.end, this.parentWidth);
|
||||
}
|
||||
ReadBuf readBuf3 = this.bb;
|
||||
readUInt = FlexBuffers.readUInt(readBuf3, FlexBuffers.indirect(readBuf3, this.end, this.parentWidth), this.parentWidth);
|
||||
}
|
||||
return (int) readUInt;
|
||||
}
|
||||
|
||||
public long asUInt() {
|
||||
int i = this.type;
|
||||
if (i == 2) {
|
||||
return FlexBuffers.readUInt(this.bb, this.end, this.parentWidth);
|
||||
}
|
||||
if (i == 1) {
|
||||
return FlexBuffers.readLong(this.bb, this.end, this.parentWidth);
|
||||
}
|
||||
if (i == 3) {
|
||||
return (long) FlexBuffers.readDouble(this.bb, this.end, this.parentWidth);
|
||||
}
|
||||
if (i == 10) {
|
||||
return asVector().size();
|
||||
}
|
||||
if (i == 26) {
|
||||
return FlexBuffers.readInt(this.bb, this.end, this.parentWidth);
|
||||
}
|
||||
if (i == 5) {
|
||||
return Long.parseLong(asString());
|
||||
}
|
||||
if (i == 6) {
|
||||
ReadBuf readBuf = this.bb;
|
||||
return FlexBuffers.readLong(readBuf, FlexBuffers.indirect(readBuf, this.end, this.parentWidth), this.byteWidth);
|
||||
}
|
||||
if (i == 7) {
|
||||
ReadBuf readBuf2 = this.bb;
|
||||
return FlexBuffers.readUInt(readBuf2, FlexBuffers.indirect(readBuf2, this.end, this.parentWidth), this.byteWidth);
|
||||
}
|
||||
if (i != 8) {
|
||||
return 0L;
|
||||
}
|
||||
ReadBuf readBuf3 = this.bb;
|
||||
return (long) FlexBuffers.readDouble(readBuf3, FlexBuffers.indirect(readBuf3, this.end, this.parentWidth), this.parentWidth);
|
||||
}
|
||||
|
||||
public long asLong() {
|
||||
int i = this.type;
|
||||
if (i == 1) {
|
||||
return FlexBuffers.readLong(this.bb, this.end, this.parentWidth);
|
||||
}
|
||||
if (i == 2) {
|
||||
return FlexBuffers.readUInt(this.bb, this.end, this.parentWidth);
|
||||
}
|
||||
if (i == 3) {
|
||||
return (long) FlexBuffers.readDouble(this.bb, this.end, this.parentWidth);
|
||||
}
|
||||
if (i == 5) {
|
||||
try {
|
||||
return Long.parseLong(asString());
|
||||
} catch (NumberFormatException unused) {
|
||||
return 0L;
|
||||
}
|
||||
}
|
||||
if (i == 6) {
|
||||
ReadBuf readBuf = this.bb;
|
||||
return FlexBuffers.readLong(readBuf, FlexBuffers.indirect(readBuf, this.end, this.parentWidth), this.byteWidth);
|
||||
}
|
||||
if (i == 7) {
|
||||
ReadBuf readBuf2 = this.bb;
|
||||
return FlexBuffers.readUInt(readBuf2, FlexBuffers.indirect(readBuf2, this.end, this.parentWidth), this.parentWidth);
|
||||
}
|
||||
if (i == 8) {
|
||||
ReadBuf readBuf3 = this.bb;
|
||||
return (long) FlexBuffers.readDouble(readBuf3, FlexBuffers.indirect(readBuf3, this.end, this.parentWidth), this.byteWidth);
|
||||
}
|
||||
if (i == 10) {
|
||||
return asVector().size();
|
||||
}
|
||||
if (i != 26) {
|
||||
return 0L;
|
||||
}
|
||||
return FlexBuffers.readInt(this.bb, this.end, this.parentWidth);
|
||||
}
|
||||
|
||||
public double asFloat() {
|
||||
int i = this.type;
|
||||
if (i == 3) {
|
||||
return FlexBuffers.readDouble(this.bb, this.end, this.parentWidth);
|
||||
}
|
||||
if (i != 1) {
|
||||
if (i != 2) {
|
||||
if (i == 5) {
|
||||
return Double.parseDouble(asString());
|
||||
}
|
||||
if (i == 6) {
|
||||
ReadBuf readBuf = this.bb;
|
||||
return FlexBuffers.readInt(readBuf, FlexBuffers.indirect(readBuf, this.end, this.parentWidth), this.byteWidth);
|
||||
}
|
||||
if (i == 7) {
|
||||
ReadBuf readBuf2 = this.bb;
|
||||
return FlexBuffers.readUInt(readBuf2, FlexBuffers.indirect(readBuf2, this.end, this.parentWidth), this.byteWidth);
|
||||
}
|
||||
if (i == 8) {
|
||||
ReadBuf readBuf3 = this.bb;
|
||||
return FlexBuffers.readDouble(readBuf3, FlexBuffers.indirect(readBuf3, this.end, this.parentWidth), this.byteWidth);
|
||||
}
|
||||
if (i == 10) {
|
||||
return asVector().size();
|
||||
}
|
||||
if (i != 26) {
|
||||
return 0.0d;
|
||||
}
|
||||
}
|
||||
return FlexBuffers.readUInt(this.bb, this.end, this.parentWidth);
|
||||
}
|
||||
return FlexBuffers.readInt(this.bb, this.end, this.parentWidth);
|
||||
}
|
||||
|
||||
public Key asKey() {
|
||||
if (isKey()) {
|
||||
ReadBuf readBuf = this.bb;
|
||||
return new Key(readBuf, FlexBuffers.indirect(readBuf, this.end, this.parentWidth), this.byteWidth);
|
||||
}
|
||||
return Key.empty();
|
||||
}
|
||||
|
||||
public String asString() {
|
||||
if (isString()) {
|
||||
int indirect = FlexBuffers.indirect(this.bb, this.end, this.parentWidth);
|
||||
ReadBuf readBuf = this.bb;
|
||||
int i = this.byteWidth;
|
||||
return this.bb.getString(indirect, (int) FlexBuffers.readUInt(readBuf, indirect - i, i));
|
||||
}
|
||||
if (!isKey()) {
|
||||
return "";
|
||||
}
|
||||
int indirect2 = FlexBuffers.indirect(this.bb, this.end, this.byteWidth);
|
||||
int i2 = indirect2;
|
||||
while (this.bb.get(i2) != 0) {
|
||||
i2++;
|
||||
}
|
||||
return this.bb.getString(indirect2, i2 - indirect2);
|
||||
}
|
||||
|
||||
public Map asMap() {
|
||||
if (isMap()) {
|
||||
ReadBuf readBuf = this.bb;
|
||||
return new Map(readBuf, FlexBuffers.indirect(readBuf, this.end, this.parentWidth), this.byteWidth);
|
||||
}
|
||||
return Map.empty();
|
||||
}
|
||||
|
||||
public Vector asVector() {
|
||||
if (isVector()) {
|
||||
ReadBuf readBuf = this.bb;
|
||||
return new Vector(readBuf, FlexBuffers.indirect(readBuf, this.end, this.parentWidth), this.byteWidth);
|
||||
}
|
||||
int i = this.type;
|
||||
if (i == 15) {
|
||||
ReadBuf readBuf2 = this.bb;
|
||||
return new TypedVector(readBuf2, FlexBuffers.indirect(readBuf2, this.end, this.parentWidth), this.byteWidth, 4);
|
||||
}
|
||||
if (FlexBuffers.isTypedVector(i)) {
|
||||
ReadBuf readBuf3 = this.bb;
|
||||
return new TypedVector(readBuf3, FlexBuffers.indirect(readBuf3, this.end, this.parentWidth), this.byteWidth, FlexBuffers.toTypedVectorElementType(this.type));
|
||||
}
|
||||
return Vector.empty();
|
||||
}
|
||||
|
||||
public Blob asBlob() {
|
||||
if (isBlob() || isString()) {
|
||||
ReadBuf readBuf = this.bb;
|
||||
return new Blob(readBuf, FlexBuffers.indirect(readBuf, this.end, this.parentWidth), this.byteWidth);
|
||||
}
|
||||
return Blob.empty();
|
||||
}
|
||||
|
||||
public boolean asBoolean() {
|
||||
return isBoolean() ? this.bb.get(this.end) != 0 : asUInt() != 0;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return toString(new StringBuilder(128)).toString();
|
||||
}
|
||||
|
||||
StringBuilder toString(StringBuilder sb) {
|
||||
int i = this.type;
|
||||
if (i != 36) {
|
||||
switch (i) {
|
||||
case 0:
|
||||
sb.append("null");
|
||||
return sb;
|
||||
case 1:
|
||||
case 6:
|
||||
sb.append(asLong());
|
||||
return sb;
|
||||
case 2:
|
||||
case 7:
|
||||
sb.append(asUInt());
|
||||
return sb;
|
||||
case 3:
|
||||
case 8:
|
||||
sb.append(asFloat());
|
||||
return sb;
|
||||
case 4:
|
||||
Key asKey = asKey();
|
||||
sb.append(Typography.quote);
|
||||
StringBuilder key = asKey.toString(sb);
|
||||
key.append(Typography.quote);
|
||||
return key;
|
||||
case 5:
|
||||
sb.append(Typography.quote);
|
||||
sb.append(asString());
|
||||
sb.append(Typography.quote);
|
||||
return sb;
|
||||
case 9:
|
||||
return asMap().toString(sb);
|
||||
case 10:
|
||||
return asVector().toString(sb);
|
||||
case 11:
|
||||
case 12:
|
||||
case 13:
|
||||
case 14:
|
||||
case 15:
|
||||
break;
|
||||
case 16:
|
||||
case 17:
|
||||
case 18:
|
||||
case 19:
|
||||
case 20:
|
||||
case 21:
|
||||
case 22:
|
||||
case 23:
|
||||
case 24:
|
||||
throw new FlexBufferException("not_implemented:" + this.type);
|
||||
case 25:
|
||||
return asBlob().toString(sb);
|
||||
case 26:
|
||||
sb.append(asBoolean());
|
||||
return sb;
|
||||
default:
|
||||
return sb;
|
||||
}
|
||||
}
|
||||
sb.append(asVector());
|
||||
return sb;
|
||||
}
|
||||
}
|
||||
|
||||
private static abstract class Object {
|
||||
ReadBuf bb;
|
||||
int byteWidth;
|
||||
int end;
|
||||
|
||||
public abstract StringBuilder toString(StringBuilder sb);
|
||||
|
||||
Object(ReadBuf readBuf, int i, int i2) {
|
||||
this.bb = readBuf;
|
||||
this.end = i;
|
||||
this.byteWidth = i2;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return toString(new StringBuilder(128)).toString();
|
||||
}
|
||||
}
|
||||
|
||||
private static abstract class Sized extends Object {
|
||||
protected final int size;
|
||||
|
||||
public int size() {
|
||||
return this.size;
|
||||
}
|
||||
|
||||
Sized(ReadBuf readBuf, int i, int i2) {
|
||||
super(readBuf, i, i2);
|
||||
this.size = FlexBuffers.readInt(this.bb, i - i2, i2);
|
||||
}
|
||||
}
|
||||
|
||||
public static class Blob extends Sized {
|
||||
static final /* synthetic */ boolean $assertionsDisabled = false;
|
||||
static final Blob EMPTY = new Blob(FlexBuffers.EMPTY_BB, 1, 1);
|
||||
|
||||
public static Blob empty() {
|
||||
return EMPTY;
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.FlexBuffers.Sized
|
||||
public /* bridge */ /* synthetic */ int size() {
|
||||
return super.size();
|
||||
}
|
||||
|
||||
Blob(ReadBuf readBuf, int i, int i2) {
|
||||
super(readBuf, i, i2);
|
||||
}
|
||||
|
||||
public ByteBuffer data() {
|
||||
ByteBuffer wrap = ByteBuffer.wrap(this.bb.data());
|
||||
wrap.position(this.end);
|
||||
wrap.limit(this.end + size());
|
||||
return wrap.asReadOnlyBuffer().slice();
|
||||
}
|
||||
|
||||
public byte[] getBytes() {
|
||||
int size = size();
|
||||
byte[] bArr = new byte[size];
|
||||
for (int i = 0; i < size; i++) {
|
||||
bArr[i] = this.bb.get(this.end + i);
|
||||
}
|
||||
return bArr;
|
||||
}
|
||||
|
||||
public byte get(int i) {
|
||||
return this.bb.get(this.end + i);
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.FlexBuffers.Object
|
||||
public String toString() {
|
||||
return this.bb.getString(this.end, size());
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.FlexBuffers.Object
|
||||
public StringBuilder toString(StringBuilder sb) {
|
||||
sb.append(Typography.quote);
|
||||
sb.append(this.bb.getString(this.end, size()));
|
||||
sb.append(Typography.quote);
|
||||
return sb;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Key extends Object {
|
||||
private static final Key EMPTY = new Key(FlexBuffers.EMPTY_BB, 0, 0);
|
||||
|
||||
public static Key empty() {
|
||||
return EMPTY;
|
||||
}
|
||||
|
||||
Key(ReadBuf readBuf, int i, int i2) {
|
||||
super(readBuf, i, i2);
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.FlexBuffers.Object
|
||||
public StringBuilder toString(StringBuilder sb) {
|
||||
sb.append(toString());
|
||||
return sb;
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.FlexBuffers.Object
|
||||
public String toString() {
|
||||
int i = this.end;
|
||||
while (this.bb.get(i) != 0) {
|
||||
i++;
|
||||
}
|
||||
return this.bb.getString(this.end, i - this.end);
|
||||
}
|
||||
|
||||
int compareTo(byte[] bArr) {
|
||||
byte b;
|
||||
byte b2;
|
||||
int i = this.end;
|
||||
int i2 = 0;
|
||||
do {
|
||||
b = this.bb.get(i);
|
||||
b2 = bArr[i2];
|
||||
if (b == 0) {
|
||||
return b - b2;
|
||||
}
|
||||
i++;
|
||||
i2++;
|
||||
if (i2 == bArr.length) {
|
||||
return b - b2;
|
||||
}
|
||||
} while (b == b2);
|
||||
return b - b2;
|
||||
}
|
||||
|
||||
public boolean equals(java.lang.Object obj) {
|
||||
if (!(obj instanceof Key)) {
|
||||
return false;
|
||||
}
|
||||
Key key = (Key) obj;
|
||||
return key.end == this.end && key.byteWidth == this.byteWidth;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return this.end ^ this.byteWidth;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Map extends Vector {
|
||||
private static final Map EMPTY_MAP = new Map(FlexBuffers.EMPTY_BB, 1, 1);
|
||||
|
||||
public static Map empty() {
|
||||
return EMPTY_MAP;
|
||||
}
|
||||
|
||||
Map(ReadBuf readBuf, int i, int i2) {
|
||||
super(readBuf, i, i2);
|
||||
}
|
||||
|
||||
public Reference get(String str) {
|
||||
return get(str.getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
public Reference get(byte[] bArr) {
|
||||
KeyVector keys = keys();
|
||||
int size = keys.size();
|
||||
int binarySearch = binarySearch(keys, bArr);
|
||||
if (binarySearch >= 0 && binarySearch < size) {
|
||||
return get(binarySearch);
|
||||
}
|
||||
return Reference.NULL_REFERENCE;
|
||||
}
|
||||
|
||||
public KeyVector keys() {
|
||||
int i = this.end - (this.byteWidth * 3);
|
||||
return new KeyVector(new TypedVector(this.bb, FlexBuffers.indirect(this.bb, i, this.byteWidth), FlexBuffers.readInt(this.bb, i + this.byteWidth, this.byteWidth), 4));
|
||||
}
|
||||
|
||||
public Vector values() {
|
||||
return new Vector(this.bb, this.end, this.byteWidth);
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.FlexBuffers.Vector, androidx.emoji2.text.flatbuffer.FlexBuffers.Object
|
||||
public StringBuilder toString(StringBuilder sb) {
|
||||
sb.append("{ ");
|
||||
KeyVector keys = keys();
|
||||
int size = size();
|
||||
Vector values = values();
|
||||
for (int i = 0; i < size; i++) {
|
||||
sb.append(Typography.quote);
|
||||
sb.append(keys.get(i).toString());
|
||||
sb.append("\" : ");
|
||||
sb.append(values.get(i).toString());
|
||||
if (i != size - 1) {
|
||||
sb.append(", ");
|
||||
}
|
||||
}
|
||||
sb.append(" }");
|
||||
return sb;
|
||||
}
|
||||
|
||||
private int binarySearch(KeyVector keyVector, byte[] bArr) {
|
||||
int size = keyVector.size() - 1;
|
||||
int i = 0;
|
||||
while (i <= size) {
|
||||
int i2 = (i + size) >>> 1;
|
||||
int compareTo = keyVector.get(i2).compareTo(bArr);
|
||||
if (compareTo < 0) {
|
||||
i = i2 + 1;
|
||||
} else {
|
||||
if (compareTo <= 0) {
|
||||
return i2;
|
||||
}
|
||||
size = i2 - 1;
|
||||
}
|
||||
}
|
||||
return -(i + 1);
|
||||
}
|
||||
}
|
||||
|
||||
public static class Vector extends Sized {
|
||||
private static final Vector EMPTY_VECTOR = new Vector(FlexBuffers.EMPTY_BB, 1, 1);
|
||||
|
||||
public static Vector empty() {
|
||||
return EMPTY_VECTOR;
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return this == EMPTY_VECTOR;
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.FlexBuffers.Sized
|
||||
public /* bridge */ /* synthetic */ int size() {
|
||||
return super.size();
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.FlexBuffers.Object
|
||||
public /* bridge */ /* synthetic */ String toString() {
|
||||
return super.toString();
|
||||
}
|
||||
|
||||
Vector(ReadBuf readBuf, int i, int i2) {
|
||||
super(readBuf, i, i2);
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.FlexBuffers.Object
|
||||
public StringBuilder toString(StringBuilder sb) {
|
||||
sb.append("[ ");
|
||||
int size = size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
get(i).toString(sb);
|
||||
if (i != size - 1) {
|
||||
sb.append(", ");
|
||||
}
|
||||
}
|
||||
sb.append(" ]");
|
||||
return sb;
|
||||
}
|
||||
|
||||
public Reference get(int i) {
|
||||
long size = size();
|
||||
long j = i;
|
||||
if (j >= size) {
|
||||
return Reference.NULL_REFERENCE;
|
||||
}
|
||||
return new Reference(this.bb, this.end + (i * this.byteWidth), this.byteWidth, Unsigned.byteToUnsignedInt(this.bb.get((int) (this.end + (size * this.byteWidth) + j))));
|
||||
}
|
||||
}
|
||||
|
||||
public static class TypedVector extends Vector {
|
||||
private static final TypedVector EMPTY_VECTOR = new TypedVector(FlexBuffers.EMPTY_BB, 1, 1, 1);
|
||||
private final int elemType;
|
||||
|
||||
public static TypedVector empty() {
|
||||
return EMPTY_VECTOR;
|
||||
}
|
||||
|
||||
public int getElemType() {
|
||||
return this.elemType;
|
||||
}
|
||||
|
||||
public boolean isEmptyVector() {
|
||||
return this == EMPTY_VECTOR;
|
||||
}
|
||||
|
||||
TypedVector(ReadBuf readBuf, int i, int i2, int i3) {
|
||||
super(readBuf, i, i2);
|
||||
this.elemType = i3;
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.FlexBuffers.Vector
|
||||
public Reference get(int i) {
|
||||
if (i >= size()) {
|
||||
return Reference.NULL_REFERENCE;
|
||||
}
|
||||
return new Reference(this.bb, this.end + (i * this.byteWidth), this.byteWidth, 1, this.elemType);
|
||||
}
|
||||
}
|
||||
|
||||
public static class KeyVector {
|
||||
private final TypedVector vec;
|
||||
|
||||
KeyVector(TypedVector typedVector) {
|
||||
this.vec = typedVector;
|
||||
}
|
||||
|
||||
public Key get(int i) {
|
||||
if (i >= size()) {
|
||||
return Key.EMPTY;
|
||||
}
|
||||
return new Key(this.vec.bb, FlexBuffers.indirect(this.vec.bb, this.vec.end + (i * this.vec.byteWidth), this.vec.byteWidth), 1);
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return this.vec.size();
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append('[');
|
||||
for (int i = 0; i < this.vec.size(); i++) {
|
||||
this.vec.get(i).toString(sb);
|
||||
if (i != this.vec.size() - 1) {
|
||||
sb.append(", ");
|
||||
}
|
||||
}
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
||||
public static class FlexBufferException extends RuntimeException {
|
||||
FlexBufferException(String str) {
|
||||
super(str);
|
||||
}
|
||||
}
|
||||
|
||||
static class Unsigned {
|
||||
static int byteToUnsignedInt(byte b) {
|
||||
return b & UByte.MAX_VALUE;
|
||||
}
|
||||
|
||||
static long intToUnsignedLong(int i) {
|
||||
return i & 4294967295L;
|
||||
}
|
||||
|
||||
static int shortToUnsignedInt(short s) {
|
||||
return s & UShort.MAX_VALUE;
|
||||
}
|
||||
|
||||
Unsigned() {
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,531 @@
|
||||
package androidx.emoji2.text.flatbuffer;
|
||||
|
||||
import androidx.emoji2.text.flatbuffer.FlexBuffers;
|
||||
import java.math.BigInteger;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class FlexBuffersBuilder {
|
||||
static final /* synthetic */ boolean $assertionsDisabled = false;
|
||||
public static final int BUILDER_FLAG_NONE = 0;
|
||||
public static final int BUILDER_FLAG_SHARE_ALL = 7;
|
||||
public static final int BUILDER_FLAG_SHARE_KEYS = 1;
|
||||
public static final int BUILDER_FLAG_SHARE_KEYS_AND_STRINGS = 3;
|
||||
public static final int BUILDER_FLAG_SHARE_KEY_VECTORS = 4;
|
||||
public static final int BUILDER_FLAG_SHARE_STRINGS = 2;
|
||||
private static final int WIDTH_16 = 1;
|
||||
private static final int WIDTH_32 = 2;
|
||||
private static final int WIDTH_64 = 3;
|
||||
private static final int WIDTH_8 = 0;
|
||||
private final ReadWriteBuf bb;
|
||||
private boolean finished;
|
||||
private final int flags;
|
||||
private Comparator<Value> keyComparator;
|
||||
private final HashMap<String, Integer> keyPool;
|
||||
private final ArrayList<Value> stack;
|
||||
private final HashMap<String, Integer> stringPool;
|
||||
|
||||
public ReadWriteBuf getBuffer() {
|
||||
return this.bb;
|
||||
}
|
||||
|
||||
public FlexBuffersBuilder(int i) {
|
||||
this(new ArrayReadWriteBuf(i), 1);
|
||||
}
|
||||
|
||||
public FlexBuffersBuilder() {
|
||||
this(256);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public FlexBuffersBuilder(ByteBuffer byteBuffer, int i) {
|
||||
this(new ArrayReadWriteBuf(byteBuffer.array()), i);
|
||||
}
|
||||
|
||||
public FlexBuffersBuilder(ReadWriteBuf readWriteBuf, int i) {
|
||||
this.stack = new ArrayList<>();
|
||||
this.keyPool = new HashMap<>();
|
||||
this.stringPool = new HashMap<>();
|
||||
this.finished = false;
|
||||
this.keyComparator = new Comparator<Value>() { // from class: androidx.emoji2.text.flatbuffer.FlexBuffersBuilder.1
|
||||
@Override // java.util.Comparator
|
||||
public int compare(Value value, Value value2) {
|
||||
byte b;
|
||||
byte b2;
|
||||
int i2 = value.key;
|
||||
int i3 = value2.key;
|
||||
do {
|
||||
b = FlexBuffersBuilder.this.bb.get(i2);
|
||||
b2 = FlexBuffersBuilder.this.bb.get(i3);
|
||||
if (b == 0) {
|
||||
return b - b2;
|
||||
}
|
||||
i2++;
|
||||
i3++;
|
||||
} while (b == b2);
|
||||
return b - b2;
|
||||
}
|
||||
};
|
||||
this.bb = readWriteBuf;
|
||||
this.flags = i;
|
||||
}
|
||||
|
||||
public FlexBuffersBuilder(ByteBuffer byteBuffer) {
|
||||
this(byteBuffer, 1);
|
||||
}
|
||||
|
||||
public void putBoolean(boolean z) {
|
||||
putBoolean(null, z);
|
||||
}
|
||||
|
||||
public void putBoolean(String str, boolean z) {
|
||||
this.stack.add(Value.bool(putKey(str), z));
|
||||
}
|
||||
|
||||
private int putKey(String str) {
|
||||
if (str == null) {
|
||||
return -1;
|
||||
}
|
||||
int writePosition = this.bb.writePosition();
|
||||
if ((this.flags & 1) != 0) {
|
||||
Integer num = this.keyPool.get(str);
|
||||
if (num == null) {
|
||||
byte[] bytes = str.getBytes(StandardCharsets.UTF_8);
|
||||
this.bb.put(bytes, 0, bytes.length);
|
||||
this.bb.put((byte) 0);
|
||||
this.keyPool.put(str, Integer.valueOf(writePosition));
|
||||
return writePosition;
|
||||
}
|
||||
return num.intValue();
|
||||
}
|
||||
byte[] bytes2 = str.getBytes(StandardCharsets.UTF_8);
|
||||
this.bb.put(bytes2, 0, bytes2.length);
|
||||
this.bb.put((byte) 0);
|
||||
this.keyPool.put(str, Integer.valueOf(writePosition));
|
||||
return writePosition;
|
||||
}
|
||||
|
||||
public void putInt(int i) {
|
||||
putInt((String) null, i);
|
||||
}
|
||||
|
||||
public void putInt(String str, int i) {
|
||||
putInt(str, i);
|
||||
}
|
||||
|
||||
public void putInt(String str, long j) {
|
||||
int putKey = putKey(str);
|
||||
if (-128 <= j && j <= 127) {
|
||||
this.stack.add(Value.int8(putKey, (int) j));
|
||||
return;
|
||||
}
|
||||
if (-32768 <= j && j <= 32767) {
|
||||
this.stack.add(Value.int16(putKey, (int) j));
|
||||
} else if (-2147483648L <= j && j <= 2147483647L) {
|
||||
this.stack.add(Value.int32(putKey, (int) j));
|
||||
} else {
|
||||
this.stack.add(Value.int64(putKey, j));
|
||||
}
|
||||
}
|
||||
|
||||
public void putInt(long j) {
|
||||
putInt((String) null, j);
|
||||
}
|
||||
|
||||
public void putUInt(int i) {
|
||||
putUInt(null, i);
|
||||
}
|
||||
|
||||
public void putUInt(long j) {
|
||||
putUInt(null, j);
|
||||
}
|
||||
|
||||
public void putUInt64(BigInteger bigInteger) {
|
||||
putUInt64(null, bigInteger.longValue());
|
||||
}
|
||||
|
||||
private void putUInt64(String str, long j) {
|
||||
this.stack.add(Value.uInt64(putKey(str), j));
|
||||
}
|
||||
|
||||
private void putUInt(String str, long j) {
|
||||
Value uInt64;
|
||||
int putKey = putKey(str);
|
||||
int widthUInBits = widthUInBits(j);
|
||||
if (widthUInBits == 0) {
|
||||
uInt64 = Value.uInt8(putKey, (int) j);
|
||||
} else if (widthUInBits == 1) {
|
||||
uInt64 = Value.uInt16(putKey, (int) j);
|
||||
} else if (widthUInBits == 2) {
|
||||
uInt64 = Value.uInt32(putKey, (int) j);
|
||||
} else {
|
||||
uInt64 = Value.uInt64(putKey, j);
|
||||
}
|
||||
this.stack.add(uInt64);
|
||||
}
|
||||
|
||||
public void putFloat(float f) {
|
||||
putFloat((String) null, f);
|
||||
}
|
||||
|
||||
public void putFloat(String str, float f) {
|
||||
this.stack.add(Value.float32(putKey(str), f));
|
||||
}
|
||||
|
||||
public void putFloat(double d) {
|
||||
putFloat((String) null, d);
|
||||
}
|
||||
|
||||
public void putFloat(String str, double d) {
|
||||
this.stack.add(Value.float64(putKey(str), d));
|
||||
}
|
||||
|
||||
public int putString(String str) {
|
||||
return putString(null, str);
|
||||
}
|
||||
|
||||
public int putString(String str, String str2) {
|
||||
long j;
|
||||
int putKey = putKey(str);
|
||||
if ((this.flags & 2) != 0) {
|
||||
Integer num = this.stringPool.get(str2);
|
||||
if (num == null) {
|
||||
Value writeString = writeString(putKey, str2);
|
||||
this.stringPool.put(str2, Integer.valueOf((int) writeString.iValue));
|
||||
this.stack.add(writeString);
|
||||
j = writeString.iValue;
|
||||
} else {
|
||||
this.stack.add(Value.blob(putKey, num.intValue(), 5, widthUInBits(str2.length())));
|
||||
return num.intValue();
|
||||
}
|
||||
} else {
|
||||
Value writeString2 = writeString(putKey, str2);
|
||||
this.stack.add(writeString2);
|
||||
j = writeString2.iValue;
|
||||
}
|
||||
return (int) j;
|
||||
}
|
||||
|
||||
private Value writeString(int i, String str) {
|
||||
return writeBlob(i, str.getBytes(StandardCharsets.UTF_8), 5, true);
|
||||
}
|
||||
|
||||
static int widthUInBits(long j) {
|
||||
if (j <= FlexBuffers.Unsigned.byteToUnsignedInt((byte) -1)) {
|
||||
return 0;
|
||||
}
|
||||
if (j <= FlexBuffers.Unsigned.shortToUnsignedInt((short) -1)) {
|
||||
return 1;
|
||||
}
|
||||
return j <= FlexBuffers.Unsigned.intToUnsignedLong(-1) ? 2 : 3;
|
||||
}
|
||||
|
||||
private Value writeBlob(int i, byte[] bArr, int i2, boolean z) {
|
||||
int widthUInBits = widthUInBits(bArr.length);
|
||||
writeInt(bArr.length, align(widthUInBits));
|
||||
int writePosition = this.bb.writePosition();
|
||||
this.bb.put(bArr, 0, bArr.length);
|
||||
if (z) {
|
||||
this.bb.put((byte) 0);
|
||||
}
|
||||
return Value.blob(i, writePosition, i2, widthUInBits);
|
||||
}
|
||||
|
||||
private int align(int i) {
|
||||
int i2 = 1 << i;
|
||||
int paddingBytes = Value.paddingBytes(this.bb.writePosition(), i2);
|
||||
while (true) {
|
||||
int i3 = paddingBytes - 1;
|
||||
if (paddingBytes == 0) {
|
||||
return i2;
|
||||
}
|
||||
this.bb.put((byte) 0);
|
||||
paddingBytes = i3;
|
||||
}
|
||||
}
|
||||
|
||||
private void writeInt(long j, int i) {
|
||||
if (i == 1) {
|
||||
this.bb.put((byte) j);
|
||||
return;
|
||||
}
|
||||
if (i == 2) {
|
||||
this.bb.putShort((short) j);
|
||||
} else if (i == 4) {
|
||||
this.bb.putInt((int) j);
|
||||
} else {
|
||||
if (i != 8) {
|
||||
return;
|
||||
}
|
||||
this.bb.putLong(j);
|
||||
}
|
||||
}
|
||||
|
||||
public int putBlob(byte[] bArr) {
|
||||
return putBlob(null, bArr);
|
||||
}
|
||||
|
||||
public int putBlob(String str, byte[] bArr) {
|
||||
Value writeBlob = writeBlob(putKey(str), bArr, 25, false);
|
||||
this.stack.add(writeBlob);
|
||||
return (int) writeBlob.iValue;
|
||||
}
|
||||
|
||||
public int startVector() {
|
||||
return this.stack.size();
|
||||
}
|
||||
|
||||
public int endVector(String str, int i, boolean z, boolean z2) {
|
||||
Value createVector = createVector(putKey(str), i, this.stack.size() - i, z, z2, null);
|
||||
while (this.stack.size() > i) {
|
||||
this.stack.remove(r10.size() - 1);
|
||||
}
|
||||
this.stack.add(createVector);
|
||||
return (int) createVector.iValue;
|
||||
}
|
||||
|
||||
public ByteBuffer finish() {
|
||||
int align = align(this.stack.get(0).elemWidth(this.bb.writePosition(), 0));
|
||||
writeAny(this.stack.get(0), align);
|
||||
this.bb.put(this.stack.get(0).storedPackedType());
|
||||
this.bb.put((byte) align);
|
||||
this.finished = true;
|
||||
return ByteBuffer.wrap(this.bb.data(), 0, this.bb.writePosition());
|
||||
}
|
||||
|
||||
private Value createVector(int i, int i2, int i3, boolean z, boolean z2, Value value) {
|
||||
int i4;
|
||||
int i5;
|
||||
int i6 = i3;
|
||||
long j = i6;
|
||||
int max = Math.max(0, widthUInBits(j));
|
||||
if (value != null) {
|
||||
max = Math.max(max, value.elemWidth(this.bb.writePosition(), 0));
|
||||
i4 = 3;
|
||||
} else {
|
||||
i4 = 1;
|
||||
}
|
||||
int i7 = 4;
|
||||
int i8 = max;
|
||||
for (int i9 = i2; i9 < this.stack.size(); i9++) {
|
||||
i8 = Math.max(i8, this.stack.get(i9).elemWidth(this.bb.writePosition(), i9 + i4));
|
||||
if (z && i9 == i2) {
|
||||
i7 = this.stack.get(i9).type;
|
||||
if (!FlexBuffers.isTypedVectorElementType(i7)) {
|
||||
throw new FlexBuffers.FlexBufferException("TypedVector does not support this element type");
|
||||
}
|
||||
}
|
||||
}
|
||||
int i10 = i2;
|
||||
int align = align(i8);
|
||||
if (value != null) {
|
||||
writeOffset(value.iValue, align);
|
||||
writeInt(1 << value.minBitWidth, align);
|
||||
}
|
||||
if (!z2) {
|
||||
writeInt(j, align);
|
||||
}
|
||||
int writePosition = this.bb.writePosition();
|
||||
for (int i11 = i10; i11 < this.stack.size(); i11++) {
|
||||
writeAny(this.stack.get(i11), align);
|
||||
}
|
||||
if (!z) {
|
||||
while (i10 < this.stack.size()) {
|
||||
this.bb.put(this.stack.get(i10).storedPackedType(i8));
|
||||
i10++;
|
||||
}
|
||||
}
|
||||
if (value != null) {
|
||||
i5 = 9;
|
||||
} else if (z) {
|
||||
if (!z2) {
|
||||
i6 = 0;
|
||||
}
|
||||
i5 = FlexBuffers.toTypedVector(i7, i6);
|
||||
} else {
|
||||
i5 = 10;
|
||||
}
|
||||
return new Value(i, i5, i8, writePosition);
|
||||
}
|
||||
|
||||
private void writeOffset(long j, int i) {
|
||||
writeInt((int) (this.bb.writePosition() - j), i);
|
||||
}
|
||||
|
||||
private void writeAny(Value value, int i) {
|
||||
int i2 = value.type;
|
||||
if (i2 != 0 && i2 != 1 && i2 != 2) {
|
||||
if (i2 == 3) {
|
||||
writeDouble(value.dValue, i);
|
||||
return;
|
||||
} else if (i2 != 26) {
|
||||
writeOffset(value.iValue, i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
writeInt(value.iValue, i);
|
||||
}
|
||||
|
||||
private void writeDouble(double d, int i) {
|
||||
if (i == 4) {
|
||||
this.bb.putFloat((float) d);
|
||||
} else if (i == 8) {
|
||||
this.bb.putDouble(d);
|
||||
}
|
||||
}
|
||||
|
||||
public int startMap() {
|
||||
return this.stack.size();
|
||||
}
|
||||
|
||||
public int endMap(String str, int i) {
|
||||
int putKey = putKey(str);
|
||||
ArrayList<Value> arrayList = this.stack;
|
||||
Collections.sort(arrayList.subList(i, arrayList.size()), this.keyComparator);
|
||||
Value createVector = createVector(putKey, i, this.stack.size() - i, false, false, createKeyVector(i, this.stack.size() - i));
|
||||
while (this.stack.size() > i) {
|
||||
this.stack.remove(r0.size() - 1);
|
||||
}
|
||||
this.stack.add(createVector);
|
||||
return (int) createVector.iValue;
|
||||
}
|
||||
|
||||
private Value createKeyVector(int i, int i2) {
|
||||
long j = i2;
|
||||
int max = Math.max(0, widthUInBits(j));
|
||||
int i3 = i;
|
||||
while (i3 < this.stack.size()) {
|
||||
i3++;
|
||||
max = Math.max(max, Value.elemWidth(4, 0, this.stack.get(i3).key, this.bb.writePosition(), i3));
|
||||
}
|
||||
int align = align(max);
|
||||
writeInt(j, align);
|
||||
int writePosition = this.bb.writePosition();
|
||||
while (i < this.stack.size()) {
|
||||
int i4 = this.stack.get(i).key;
|
||||
writeOffset(this.stack.get(i).key, align);
|
||||
i++;
|
||||
}
|
||||
return new Value(-1, FlexBuffers.toTypedVector(4, 0), max, writePosition);
|
||||
}
|
||||
|
||||
private static class Value {
|
||||
static final /* synthetic */ boolean $assertionsDisabled = false;
|
||||
final double dValue;
|
||||
long iValue;
|
||||
int key;
|
||||
final int minBitWidth;
|
||||
final int type;
|
||||
|
||||
private static byte packedType(int i, int i2) {
|
||||
return (byte) (i | (i2 << 2));
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public static int paddingBytes(int i, int i2) {
|
||||
return ((~i) + 1) & (i2 - 1);
|
||||
}
|
||||
|
||||
Value(int i, int i2, int i3, long j) {
|
||||
this.key = i;
|
||||
this.type = i2;
|
||||
this.minBitWidth = i3;
|
||||
this.iValue = j;
|
||||
this.dValue = Double.MIN_VALUE;
|
||||
}
|
||||
|
||||
Value(int i, int i2, int i3, double d) {
|
||||
this.key = i;
|
||||
this.type = i2;
|
||||
this.minBitWidth = i3;
|
||||
this.dValue = d;
|
||||
this.iValue = Long.MIN_VALUE;
|
||||
}
|
||||
|
||||
static Value bool(int i, boolean z) {
|
||||
return new Value(i, 26, 0, z ? 1L : 0L);
|
||||
}
|
||||
|
||||
static Value blob(int i, int i2, int i3, int i4) {
|
||||
return new Value(i, i3, i4, i2);
|
||||
}
|
||||
|
||||
static Value int8(int i, int i2) {
|
||||
return new Value(i, 1, 0, i2);
|
||||
}
|
||||
|
||||
static Value int16(int i, int i2) {
|
||||
return new Value(i, 1, 1, i2);
|
||||
}
|
||||
|
||||
static Value int32(int i, int i2) {
|
||||
return new Value(i, 1, 2, i2);
|
||||
}
|
||||
|
||||
static Value int64(int i, long j) {
|
||||
return new Value(i, 1, 3, j);
|
||||
}
|
||||
|
||||
static Value uInt8(int i, int i2) {
|
||||
return new Value(i, 2, 0, i2);
|
||||
}
|
||||
|
||||
static Value uInt16(int i, int i2) {
|
||||
return new Value(i, 2, 1, i2);
|
||||
}
|
||||
|
||||
static Value uInt32(int i, int i2) {
|
||||
return new Value(i, 2, 2, i2);
|
||||
}
|
||||
|
||||
static Value uInt64(int i, long j) {
|
||||
return new Value(i, 2, 3, j);
|
||||
}
|
||||
|
||||
static Value float32(int i, float f) {
|
||||
return new Value(i, 3, 2, f);
|
||||
}
|
||||
|
||||
static Value float64(int i, double d) {
|
||||
return new Value(i, 3, 3, d);
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public byte storedPackedType() {
|
||||
return storedPackedType(0);
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public byte storedPackedType(int i) {
|
||||
return packedType(storedWidth(i), this.type);
|
||||
}
|
||||
|
||||
private int storedWidth(int i) {
|
||||
return FlexBuffers.isTypeInline(this.type) ? Math.max(this.minBitWidth, i) : this.minBitWidth;
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public int elemWidth(int i, int i2) {
|
||||
return elemWidth(this.type, this.minBitWidth, this.iValue, i, i2);
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public static int elemWidth(int i, int i2, long j, int i3, int i4) {
|
||||
if (FlexBuffers.isTypeInline(i)) {
|
||||
return i2;
|
||||
}
|
||||
for (int i5 = 1; i5 <= 32; i5 *= 2) {
|
||||
int widthUInBits = FlexBuffersBuilder.widthUInBits((int) (((paddingBytes(i3, i5) + i3) + (i4 * i5)) - j));
|
||||
if ((1 << widthUInBits) == i5) {
|
||||
return widthUInBits;
|
||||
}
|
||||
}
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package androidx.emoji2.text.flatbuffer;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class FloatVector extends BaseVector {
|
||||
public FloatVector __assign(int i, ByteBuffer byteBuffer) {
|
||||
__reset(i, 4, byteBuffer);
|
||||
return this;
|
||||
}
|
||||
|
||||
public float get(int i) {
|
||||
return this.bb.getFloat(__element(i));
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package androidx.emoji2.text.flatbuffer;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class IntVector extends BaseVector {
|
||||
public IntVector __assign(int i, ByteBuffer byteBuffer) {
|
||||
__reset(i, 4, byteBuffer);
|
||||
return this;
|
||||
}
|
||||
|
||||
public int get(int i) {
|
||||
return this.bb.getInt(__element(i));
|
||||
}
|
||||
|
||||
public long getAsUnsigned(int i) {
|
||||
return get(i) & 4294967295L;
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package androidx.emoji2.text.flatbuffer;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class LongVector extends BaseVector {
|
||||
public LongVector __assign(int i, ByteBuffer byteBuffer) {
|
||||
__reset(i, 8, byteBuffer);
|
||||
return this;
|
||||
}
|
||||
|
||||
public long get(int i) {
|
||||
return this.bb.getLong(__element(i));
|
||||
}
|
||||
}
|
@ -0,0 +1,185 @@
|
||||
package androidx.emoji2.text.flatbuffer;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class MetadataItem extends Table {
|
||||
public static void ValidateVersion() {
|
||||
Constants.FLATBUFFERS_1_12_0();
|
||||
}
|
||||
|
||||
public static MetadataItem getRootAsMetadataItem(ByteBuffer byteBuffer) {
|
||||
return getRootAsMetadataItem(byteBuffer, new MetadataItem());
|
||||
}
|
||||
|
||||
public static MetadataItem getRootAsMetadataItem(ByteBuffer byteBuffer, MetadataItem metadataItem) {
|
||||
byteBuffer.order(ByteOrder.LITTLE_ENDIAN);
|
||||
return metadataItem.__assign(byteBuffer.getInt(byteBuffer.position()) + byteBuffer.position(), byteBuffer);
|
||||
}
|
||||
|
||||
public void __init(int i, ByteBuffer byteBuffer) {
|
||||
__reset(i, byteBuffer);
|
||||
}
|
||||
|
||||
public MetadataItem __assign(int i, ByteBuffer byteBuffer) {
|
||||
__init(i, byteBuffer);
|
||||
return this;
|
||||
}
|
||||
|
||||
public int id() {
|
||||
int __offset = __offset(4);
|
||||
if (__offset != 0) {
|
||||
return this.bb.getInt(__offset + this.bb_pos);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public boolean emojiStyle() {
|
||||
int __offset = __offset(6);
|
||||
return (__offset == 0 || this.bb.get(__offset + this.bb_pos) == 0) ? false : true;
|
||||
}
|
||||
|
||||
public short sdkAdded() {
|
||||
int __offset = __offset(8);
|
||||
if (__offset != 0) {
|
||||
return this.bb.getShort(__offset + this.bb_pos);
|
||||
}
|
||||
return (short) 0;
|
||||
}
|
||||
|
||||
public short compatAdded() {
|
||||
int __offset = __offset(10);
|
||||
if (__offset != 0) {
|
||||
return this.bb.getShort(__offset + this.bb_pos);
|
||||
}
|
||||
return (short) 0;
|
||||
}
|
||||
|
||||
public short width() {
|
||||
int __offset = __offset(12);
|
||||
if (__offset != 0) {
|
||||
return this.bb.getShort(__offset + this.bb_pos);
|
||||
}
|
||||
return (short) 0;
|
||||
}
|
||||
|
||||
public short height() {
|
||||
int __offset = __offset(14);
|
||||
if (__offset != 0) {
|
||||
return this.bb.getShort(__offset + this.bb_pos);
|
||||
}
|
||||
return (short) 0;
|
||||
}
|
||||
|
||||
public int codepoints(int i) {
|
||||
int __offset = __offset(16);
|
||||
if (__offset != 0) {
|
||||
return this.bb.getInt(__vector(__offset) + (i * 4));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int codepointsLength() {
|
||||
int __offset = __offset(16);
|
||||
if (__offset != 0) {
|
||||
return __vector_len(__offset);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public IntVector codepointsVector() {
|
||||
return codepointsVector(new IntVector());
|
||||
}
|
||||
|
||||
public IntVector codepointsVector(IntVector intVector) {
|
||||
int __offset = __offset(16);
|
||||
if (__offset != 0) {
|
||||
return intVector.__assign(__vector(__offset), this.bb);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public ByteBuffer codepointsAsByteBuffer() {
|
||||
return __vector_as_bytebuffer(16, 4);
|
||||
}
|
||||
|
||||
public ByteBuffer codepointsInByteBuffer(ByteBuffer byteBuffer) {
|
||||
return __vector_in_bytebuffer(byteBuffer, 16, 4);
|
||||
}
|
||||
|
||||
public static int createMetadataItem(FlatBufferBuilder flatBufferBuilder, int i, boolean z, short s, short s2, short s3, short s4, int i2) {
|
||||
flatBufferBuilder.startTable(7);
|
||||
addCodepoints(flatBufferBuilder, i2);
|
||||
addId(flatBufferBuilder, i);
|
||||
addHeight(flatBufferBuilder, s4);
|
||||
addWidth(flatBufferBuilder, s3);
|
||||
addCompatAdded(flatBufferBuilder, s2);
|
||||
addSdkAdded(flatBufferBuilder, s);
|
||||
addEmojiStyle(flatBufferBuilder, z);
|
||||
return endMetadataItem(flatBufferBuilder);
|
||||
}
|
||||
|
||||
public static void startMetadataItem(FlatBufferBuilder flatBufferBuilder) {
|
||||
flatBufferBuilder.startTable(7);
|
||||
}
|
||||
|
||||
public static void addId(FlatBufferBuilder flatBufferBuilder, int i) {
|
||||
flatBufferBuilder.addInt(0, i, 0);
|
||||
}
|
||||
|
||||
public static void addEmojiStyle(FlatBufferBuilder flatBufferBuilder, boolean z) {
|
||||
flatBufferBuilder.addBoolean(1, z, false);
|
||||
}
|
||||
|
||||
public static void addSdkAdded(FlatBufferBuilder flatBufferBuilder, short s) {
|
||||
flatBufferBuilder.addShort(2, s, 0);
|
||||
}
|
||||
|
||||
public static void addCompatAdded(FlatBufferBuilder flatBufferBuilder, short s) {
|
||||
flatBufferBuilder.addShort(3, s, 0);
|
||||
}
|
||||
|
||||
public static void addWidth(FlatBufferBuilder flatBufferBuilder, short s) {
|
||||
flatBufferBuilder.addShort(4, s, 0);
|
||||
}
|
||||
|
||||
public static void addHeight(FlatBufferBuilder flatBufferBuilder, short s) {
|
||||
flatBufferBuilder.addShort(5, s, 0);
|
||||
}
|
||||
|
||||
public static void addCodepoints(FlatBufferBuilder flatBufferBuilder, int i) {
|
||||
flatBufferBuilder.addOffset(6, i, 0);
|
||||
}
|
||||
|
||||
public static int createCodepointsVector(FlatBufferBuilder flatBufferBuilder, int[] iArr) {
|
||||
flatBufferBuilder.startVector(4, iArr.length, 4);
|
||||
for (int length = iArr.length - 1; length >= 0; length--) {
|
||||
flatBufferBuilder.addInt(iArr[length]);
|
||||
}
|
||||
return flatBufferBuilder.endVector();
|
||||
}
|
||||
|
||||
public static void startCodepointsVector(FlatBufferBuilder flatBufferBuilder, int i) {
|
||||
flatBufferBuilder.startVector(4, i, 4);
|
||||
}
|
||||
|
||||
public static int endMetadataItem(FlatBufferBuilder flatBufferBuilder) {
|
||||
return flatBufferBuilder.endTable();
|
||||
}
|
||||
|
||||
public static final class Vector extends BaseVector {
|
||||
public Vector __assign(int i, int i2, ByteBuffer byteBuffer) {
|
||||
__reset(i, i2, byteBuffer);
|
||||
return this;
|
||||
}
|
||||
|
||||
public MetadataItem get(int i) {
|
||||
return get(new MetadataItem(), i);
|
||||
}
|
||||
|
||||
public MetadataItem get(MetadataItem metadataItem, int i) {
|
||||
return metadataItem.__assign(MetadataItem.__indirect(__element(i), this.bb), this.bb);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,149 @@
|
||||
package androidx.emoji2.text.flatbuffer;
|
||||
|
||||
import androidx.emoji2.text.flatbuffer.MetadataItem;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class MetadataList extends Table {
|
||||
public static void ValidateVersion() {
|
||||
Constants.FLATBUFFERS_1_12_0();
|
||||
}
|
||||
|
||||
public static MetadataList getRootAsMetadataList(ByteBuffer byteBuffer) {
|
||||
return getRootAsMetadataList(byteBuffer, new MetadataList());
|
||||
}
|
||||
|
||||
public static MetadataList getRootAsMetadataList(ByteBuffer byteBuffer, MetadataList metadataList) {
|
||||
byteBuffer.order(ByteOrder.LITTLE_ENDIAN);
|
||||
return metadataList.__assign(byteBuffer.getInt(byteBuffer.position()) + byteBuffer.position(), byteBuffer);
|
||||
}
|
||||
|
||||
public void __init(int i, ByteBuffer byteBuffer) {
|
||||
__reset(i, byteBuffer);
|
||||
}
|
||||
|
||||
public MetadataList __assign(int i, ByteBuffer byteBuffer) {
|
||||
__init(i, byteBuffer);
|
||||
return this;
|
||||
}
|
||||
|
||||
public int version() {
|
||||
int __offset = __offset(4);
|
||||
if (__offset != 0) {
|
||||
return this.bb.getInt(__offset + this.bb_pos);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public MetadataItem list(int i) {
|
||||
return list(new MetadataItem(), i);
|
||||
}
|
||||
|
||||
public MetadataItem list(MetadataItem metadataItem, int i) {
|
||||
int __offset = __offset(6);
|
||||
if (__offset != 0) {
|
||||
return metadataItem.__assign(__indirect(__vector(__offset) + (i * 4)), this.bb);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public int listLength() {
|
||||
int __offset = __offset(6);
|
||||
if (__offset != 0) {
|
||||
return __vector_len(__offset);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public MetadataItem.Vector listVector() {
|
||||
return listVector(new MetadataItem.Vector());
|
||||
}
|
||||
|
||||
public MetadataItem.Vector listVector(MetadataItem.Vector vector) {
|
||||
int __offset = __offset(6);
|
||||
if (__offset != 0) {
|
||||
return vector.__assign(__vector(__offset), 4, this.bb);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String sourceSha() {
|
||||
int __offset = __offset(8);
|
||||
if (__offset != 0) {
|
||||
return __string(__offset + this.bb_pos);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public ByteBuffer sourceShaAsByteBuffer() {
|
||||
return __vector_as_bytebuffer(8, 1);
|
||||
}
|
||||
|
||||
public ByteBuffer sourceShaInByteBuffer(ByteBuffer byteBuffer) {
|
||||
return __vector_in_bytebuffer(byteBuffer, 8, 1);
|
||||
}
|
||||
|
||||
public static int createMetadataList(FlatBufferBuilder flatBufferBuilder, int i, int i2, int i3) {
|
||||
flatBufferBuilder.startTable(3);
|
||||
addSourceSha(flatBufferBuilder, i3);
|
||||
addList(flatBufferBuilder, i2);
|
||||
addVersion(flatBufferBuilder, i);
|
||||
return endMetadataList(flatBufferBuilder);
|
||||
}
|
||||
|
||||
public static void startMetadataList(FlatBufferBuilder flatBufferBuilder) {
|
||||
flatBufferBuilder.startTable(3);
|
||||
}
|
||||
|
||||
public static void addVersion(FlatBufferBuilder flatBufferBuilder, int i) {
|
||||
flatBufferBuilder.addInt(0, i, 0);
|
||||
}
|
||||
|
||||
public static void addList(FlatBufferBuilder flatBufferBuilder, int i) {
|
||||
flatBufferBuilder.addOffset(1, i, 0);
|
||||
}
|
||||
|
||||
public static int createListVector(FlatBufferBuilder flatBufferBuilder, int[] iArr) {
|
||||
flatBufferBuilder.startVector(4, iArr.length, 4);
|
||||
for (int length = iArr.length - 1; length >= 0; length--) {
|
||||
flatBufferBuilder.addOffset(iArr[length]);
|
||||
}
|
||||
return flatBufferBuilder.endVector();
|
||||
}
|
||||
|
||||
public static void startListVector(FlatBufferBuilder flatBufferBuilder, int i) {
|
||||
flatBufferBuilder.startVector(4, i, 4);
|
||||
}
|
||||
|
||||
public static void addSourceSha(FlatBufferBuilder flatBufferBuilder, int i) {
|
||||
flatBufferBuilder.addOffset(2, i, 0);
|
||||
}
|
||||
|
||||
public static int endMetadataList(FlatBufferBuilder flatBufferBuilder) {
|
||||
return flatBufferBuilder.endTable();
|
||||
}
|
||||
|
||||
public static void finishMetadataListBuffer(FlatBufferBuilder flatBufferBuilder, int i) {
|
||||
flatBufferBuilder.finish(i);
|
||||
}
|
||||
|
||||
public static void finishSizePrefixedMetadataListBuffer(FlatBufferBuilder flatBufferBuilder, int i) {
|
||||
flatBufferBuilder.finishSizePrefixed(i);
|
||||
}
|
||||
|
||||
public static final class Vector extends BaseVector {
|
||||
public Vector __assign(int i, int i2, ByteBuffer byteBuffer) {
|
||||
__reset(i, i2, byteBuffer);
|
||||
return this;
|
||||
}
|
||||
|
||||
public MetadataList get(int i) {
|
||||
return get(new MetadataList(), i);
|
||||
}
|
||||
|
||||
public MetadataList get(MetadataList metadataList, int i) {
|
||||
return metadataList.__assign(MetadataList.__indirect(__element(i), this.bb), this.bb);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package androidx.emoji2.text.flatbuffer;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
interface ReadBuf {
|
||||
byte[] data();
|
||||
|
||||
byte get(int i);
|
||||
|
||||
boolean getBoolean(int i);
|
||||
|
||||
double getDouble(int i);
|
||||
|
||||
float getFloat(int i);
|
||||
|
||||
int getInt(int i);
|
||||
|
||||
long getLong(int i);
|
||||
|
||||
short getShort(int i);
|
||||
|
||||
String getString(int i, int i2);
|
||||
|
||||
int limit();
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package androidx.emoji2.text.flatbuffer;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
interface ReadWriteBuf extends ReadBuf {
|
||||
@Override // androidx.emoji2.text.flatbuffer.ReadBuf
|
||||
int limit();
|
||||
|
||||
void put(byte b);
|
||||
|
||||
void put(byte[] bArr, int i, int i2);
|
||||
|
||||
void putBoolean(boolean z);
|
||||
|
||||
void putDouble(double d);
|
||||
|
||||
void putFloat(float f);
|
||||
|
||||
void putInt(int i);
|
||||
|
||||
void putLong(long j);
|
||||
|
||||
void putShort(short s);
|
||||
|
||||
boolean requestCapacity(int i);
|
||||
|
||||
void set(int i, byte b);
|
||||
|
||||
void set(int i, byte[] bArr, int i2, int i3);
|
||||
|
||||
void setBoolean(int i, boolean z);
|
||||
|
||||
void setDouble(int i, double d);
|
||||
|
||||
void setFloat(int i, float f);
|
||||
|
||||
void setInt(int i, int i2);
|
||||
|
||||
void setLong(int i, long j);
|
||||
|
||||
void setShort(int i, short s);
|
||||
|
||||
int writePosition();
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package androidx.emoji2.text.flatbuffer;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import kotlin.UShort;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class ShortVector extends BaseVector {
|
||||
public ShortVector __assign(int i, ByteBuffer byteBuffer) {
|
||||
__reset(i, 2, byteBuffer);
|
||||
return this;
|
||||
}
|
||||
|
||||
public short get(int i) {
|
||||
return this.bb.getShort(__element(i));
|
||||
}
|
||||
|
||||
public int getAsUnsigned(int i) {
|
||||
return get(i) & UShort.MAX_VALUE;
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package androidx.emoji2.text.flatbuffer;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class StringVector extends BaseVector {
|
||||
private Utf8 utf8 = Utf8.getDefault();
|
||||
|
||||
public StringVector __assign(int i, int i2, ByteBuffer byteBuffer) {
|
||||
__reset(i, i2, byteBuffer);
|
||||
return this;
|
||||
}
|
||||
|
||||
public String get(int i) {
|
||||
return Table.__string(__element(i), this.bb, this.utf8);
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package androidx.emoji2.text.flatbuffer;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class Struct {
|
||||
protected ByteBuffer bb;
|
||||
protected int bb_pos;
|
||||
|
||||
protected void __reset(int i, ByteBuffer byteBuffer) {
|
||||
this.bb = byteBuffer;
|
||||
if (byteBuffer != null) {
|
||||
this.bb_pos = i;
|
||||
} else {
|
||||
this.bb_pos = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void __reset() {
|
||||
__reset(0, null);
|
||||
}
|
||||
}
|
174
02-Easy5/E5/sources/androidx/emoji2/text/flatbuffer/Table.java
Normal file
174
02-Easy5/E5/sources/androidx/emoji2/text/flatbuffer/Table.java
Normal file
@ -0,0 +1,174 @@
|
||||
package androidx.emoji2.text.flatbuffer;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class Table {
|
||||
protected ByteBuffer bb;
|
||||
protected int bb_pos;
|
||||
Utf8 utf8 = Utf8.getDefault();
|
||||
private int vtable_size;
|
||||
private int vtable_start;
|
||||
|
||||
public ByteBuffer getByteBuffer() {
|
||||
return this.bb;
|
||||
}
|
||||
|
||||
protected int keysCompare(Integer num, Integer num2, ByteBuffer byteBuffer) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected int __offset(int i) {
|
||||
if (i < this.vtable_size) {
|
||||
return this.bb.getShort(this.vtable_start + i);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected static int __offset(int i, int i2, ByteBuffer byteBuffer) {
|
||||
int capacity = byteBuffer.capacity() - i2;
|
||||
return byteBuffer.getShort((i + capacity) - byteBuffer.getInt(capacity)) + capacity;
|
||||
}
|
||||
|
||||
protected int __indirect(int i) {
|
||||
return i + this.bb.getInt(i);
|
||||
}
|
||||
|
||||
protected static int __indirect(int i, ByteBuffer byteBuffer) {
|
||||
return i + byteBuffer.getInt(i);
|
||||
}
|
||||
|
||||
protected String __string(int i) {
|
||||
return __string(i, this.bb, this.utf8);
|
||||
}
|
||||
|
||||
protected static String __string(int i, ByteBuffer byteBuffer, Utf8 utf8) {
|
||||
int i2 = i + byteBuffer.getInt(i);
|
||||
return utf8.decodeUtf8(byteBuffer, i2 + 4, byteBuffer.getInt(i2));
|
||||
}
|
||||
|
||||
protected int __vector_len(int i) {
|
||||
int i2 = i + this.bb_pos;
|
||||
return this.bb.getInt(i2 + this.bb.getInt(i2));
|
||||
}
|
||||
|
||||
protected int __vector(int i) {
|
||||
int i2 = i + this.bb_pos;
|
||||
return i2 + this.bb.getInt(i2) + 4;
|
||||
}
|
||||
|
||||
protected ByteBuffer __vector_as_bytebuffer(int i, int i2) {
|
||||
int __offset = __offset(i);
|
||||
if (__offset == 0) {
|
||||
return null;
|
||||
}
|
||||
ByteBuffer order = this.bb.duplicate().order(ByteOrder.LITTLE_ENDIAN);
|
||||
int __vector = __vector(__offset);
|
||||
order.position(__vector);
|
||||
order.limit(__vector + (__vector_len(__offset) * i2));
|
||||
return order;
|
||||
}
|
||||
|
||||
protected ByteBuffer __vector_in_bytebuffer(ByteBuffer byteBuffer, int i, int i2) {
|
||||
int __offset = __offset(i);
|
||||
if (__offset == 0) {
|
||||
return null;
|
||||
}
|
||||
int __vector = __vector(__offset);
|
||||
byteBuffer.rewind();
|
||||
byteBuffer.limit((__vector_len(__offset) * i2) + __vector);
|
||||
byteBuffer.position(__vector);
|
||||
return byteBuffer;
|
||||
}
|
||||
|
||||
protected Table __union(Table table, int i) {
|
||||
return __union(table, i, this.bb);
|
||||
}
|
||||
|
||||
protected static Table __union(Table table, int i, ByteBuffer byteBuffer) {
|
||||
table.__reset(__indirect(i, byteBuffer), byteBuffer);
|
||||
return table;
|
||||
}
|
||||
|
||||
protected static boolean __has_identifier(ByteBuffer byteBuffer, String str) {
|
||||
if (str.length() != 4) {
|
||||
throw new AssertionError("FlatBuffers: file identifier must be length 4");
|
||||
}
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (str.charAt(i) != ((char) byteBuffer.get(byteBuffer.position() + 4 + i))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void sortTables(int[] iArr, final ByteBuffer byteBuffer) {
|
||||
Integer[] numArr = new Integer[iArr.length];
|
||||
for (int i = 0; i < iArr.length; i++) {
|
||||
numArr[i] = Integer.valueOf(iArr[i]);
|
||||
}
|
||||
Arrays.sort(numArr, new Comparator<Integer>() { // from class: androidx.emoji2.text.flatbuffer.Table.1
|
||||
@Override // java.util.Comparator
|
||||
public int compare(Integer num, Integer num2) {
|
||||
return Table.this.keysCompare(num, num2, byteBuffer);
|
||||
}
|
||||
});
|
||||
for (int i2 = 0; i2 < iArr.length; i2++) {
|
||||
iArr[i2] = numArr[i2].intValue();
|
||||
}
|
||||
}
|
||||
|
||||
protected static int compareStrings(int i, int i2, ByteBuffer byteBuffer) {
|
||||
int i3 = i + byteBuffer.getInt(i);
|
||||
int i4 = i2 + byteBuffer.getInt(i2);
|
||||
int i5 = byteBuffer.getInt(i3);
|
||||
int i6 = byteBuffer.getInt(i4);
|
||||
int i7 = i3 + 4;
|
||||
int i8 = i4 + 4;
|
||||
int min = Math.min(i5, i6);
|
||||
for (int i9 = 0; i9 < min; i9++) {
|
||||
int i10 = i9 + i7;
|
||||
int i11 = i9 + i8;
|
||||
if (byteBuffer.get(i10) != byteBuffer.get(i11)) {
|
||||
return byteBuffer.get(i10) - byteBuffer.get(i11);
|
||||
}
|
||||
}
|
||||
return i5 - i6;
|
||||
}
|
||||
|
||||
protected static int compareStrings(int i, byte[] bArr, ByteBuffer byteBuffer) {
|
||||
int i2 = i + byteBuffer.getInt(i);
|
||||
int i3 = byteBuffer.getInt(i2);
|
||||
int length = bArr.length;
|
||||
int i4 = i2 + 4;
|
||||
int min = Math.min(i3, length);
|
||||
for (int i5 = 0; i5 < min; i5++) {
|
||||
int i6 = i5 + i4;
|
||||
if (byteBuffer.get(i6) != bArr[i5]) {
|
||||
return byteBuffer.get(i6) - bArr[i5];
|
||||
}
|
||||
}
|
||||
return i3 - length;
|
||||
}
|
||||
|
||||
protected void __reset(int i, ByteBuffer byteBuffer) {
|
||||
this.bb = byteBuffer;
|
||||
if (byteBuffer == null) {
|
||||
this.bb_pos = 0;
|
||||
this.vtable_start = 0;
|
||||
this.vtable_size = 0;
|
||||
} else {
|
||||
this.bb_pos = i;
|
||||
int i2 = i - byteBuffer.getInt(i);
|
||||
this.vtable_start = i2;
|
||||
this.vtable_size = this.bb.getShort(i2);
|
||||
}
|
||||
}
|
||||
|
||||
public void __reset() {
|
||||
__reset(0, null);
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package androidx.emoji2.text.flatbuffer;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class UnionVector extends BaseVector {
|
||||
public UnionVector __assign(int i, int i2, ByteBuffer byteBuffer) {
|
||||
__reset(i, i2, byteBuffer);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Table get(Table table, int i) {
|
||||
return Table.__union(table, __element(i), this.bb);
|
||||
}
|
||||
}
|
@ -0,0 +1,94 @@
|
||||
package androidx.emoji2.text.flatbuffer;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class Utf8 {
|
||||
private static Utf8 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);
|
||||
|
||||
public static Utf8 getDefault() {
|
||||
if (DEFAULT == null) {
|
||||
DEFAULT = new Utf8Safe();
|
||||
}
|
||||
return DEFAULT;
|
||||
}
|
||||
|
||||
static class DecodeUtil {
|
||||
private static char highSurrogate(int i) {
|
||||
return (char) ((i >>> 10) + 55232);
|
||||
}
|
||||
|
||||
private static boolean isNotTrailingByte(byte b) {
|
||||
return b > -65;
|
||||
}
|
||||
|
||||
static boolean isOneByte(byte b) {
|
||||
return b >= 0;
|
||||
}
|
||||
|
||||
static boolean isThreeBytes(byte b) {
|
||||
return b < -16;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
DecodeUtil() {
|
||||
}
|
||||
|
||||
static void handleOneByte(byte b, char[] cArr, int i) {
|
||||
cArr[i] = (char) b;
|
||||
}
|
||||
|
||||
static void handleTwoBytes(byte b, byte b2, char[] cArr, int i) throws IllegalArgumentException {
|
||||
if (b < -62) {
|
||||
throw new IllegalArgumentException("Invalid UTF-8: Illegal leading byte in 2 bytes utf");
|
||||
}
|
||||
if (isNotTrailingByte(b2)) {
|
||||
throw new IllegalArgumentException("Invalid UTF-8: Illegal trailing byte in 2 bytes utf");
|
||||
}
|
||||
cArr[i] = (char) (((b & 31) << 6) | trailingByteValue(b2));
|
||||
}
|
||||
|
||||
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)))) {
|
||||
throw new IllegalArgumentException("Invalid UTF-8");
|
||||
}
|
||||
cArr[i] = (char) (((b & 15) << 12) | (trailingByteValue(b2) << 6) | trailingByteValue(b3));
|
||||
}
|
||||
|
||||
static void handleFourBytes(byte b, byte b2, byte b3, byte b4, char[] cArr, int i) throws IllegalArgumentException {
|
||||
if (isNotTrailingByte(b2) || (((b << 28) + (b2 + 112)) >> 30) != 0 || isNotTrailingByte(b3) || isNotTrailingByte(b4)) {
|
||||
throw new IllegalArgumentException("Invalid UTF-8");
|
||||
}
|
||||
int trailingByteValue = ((b & 7) << 18) | (trailingByteValue(b2) << 12) | (trailingByteValue(b3) << 6) | trailingByteValue(b4);
|
||||
cArr[i] = highSurrogate(trailingByteValue);
|
||||
cArr[i + 1] = lowSurrogate(trailingByteValue);
|
||||
}
|
||||
}
|
||||
|
||||
static class UnpairedSurrogateException extends IllegalArgumentException {
|
||||
UnpairedSurrogateException(int i, int i2) {
|
||||
super("Unpaired surrogate at index " + i + " of " + i2);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
package androidx.emoji2.text.flatbuffer;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.CharBuffer;
|
||||
import java.nio.charset.CharacterCodingException;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import java.nio.charset.CoderResult;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class Utf8Old extends Utf8 {
|
||||
private static final ThreadLocal<Cache> CACHE;
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
static class Cache {
|
||||
CharSequence lastInput = null;
|
||||
ByteBuffer lastOutput = null;
|
||||
final CharsetEncoder encoder = StandardCharsets.UTF_8.newEncoder();
|
||||
final CharsetDecoder decoder = StandardCharsets.UTF_8.newDecoder();
|
||||
|
||||
Cache() {
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
ThreadLocal<Cache> withInitial;
|
||||
withInitial = ThreadLocal.withInitial(new Supplier() { // from class: androidx.emoji2.text.flatbuffer.Utf8Old$$ExternalSyntheticLambda1
|
||||
@Override // java.util.function.Supplier
|
||||
public final Object get() {
|
||||
return Utf8Old.lambda$static$0();
|
||||
}
|
||||
});
|
||||
CACHE = withInitial;
|
||||
}
|
||||
|
||||
static /* synthetic */ Cache lambda$static$0() {
|
||||
return new Cache();
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.Utf8
|
||||
public int encodedLength(CharSequence charSequence) {
|
||||
Cache cache = CACHE.get();
|
||||
int length = (int) (charSequence.length() * cache.encoder.maxBytesPerChar());
|
||||
if (cache.lastOutput == null || cache.lastOutput.capacity() < length) {
|
||||
cache.lastOutput = ByteBuffer.allocate(Math.max(128, length));
|
||||
}
|
||||
cache.lastOutput.clear();
|
||||
cache.lastInput = charSequence;
|
||||
CoderResult encode = cache.encoder.encode(charSequence instanceof CharBuffer ? (CharBuffer) charSequence : CharBuffer.wrap(charSequence), cache.lastOutput, true);
|
||||
if (encode.isError()) {
|
||||
try {
|
||||
encode.throwException();
|
||||
} catch (CharacterCodingException e) {
|
||||
throw new IllegalArgumentException("bad character encoding", e);
|
||||
}
|
||||
}
|
||||
cache.lastOutput.flip();
|
||||
return cache.lastOutput.remaining();
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.Utf8
|
||||
public void encodeUtf8(CharSequence charSequence, ByteBuffer byteBuffer) {
|
||||
Cache cache = CACHE.get();
|
||||
if (cache.lastInput != charSequence) {
|
||||
encodedLength(charSequence);
|
||||
}
|
||||
byteBuffer.put(cache.lastOutput);
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.Utf8
|
||||
public String decodeUtf8(ByteBuffer byteBuffer, int i, int i2) {
|
||||
CharsetDecoder charsetDecoder = CACHE.get().decoder;
|
||||
charsetDecoder.reset();
|
||||
ByteBuffer duplicate = byteBuffer.duplicate();
|
||||
duplicate.position(i);
|
||||
duplicate.limit(i + i2);
|
||||
try {
|
||||
return charsetDecoder.decode(duplicate).toString();
|
||||
} catch (CharacterCodingException e) {
|
||||
throw new IllegalArgumentException("Bad encoding", e);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,309 @@
|
||||
package androidx.emoji2.text.flatbuffer;
|
||||
|
||||
import androidx.emoji2.text.flatbuffer.Utf8;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class Utf8Safe extends Utf8 {
|
||||
private static int computeEncodedLength(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 String decodeUtf8Array(byte[] bArr, int i, int i2) {
|
||||
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 (!Utf8.DecodeUtil.isOneByte(b)) {
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
Utf8.DecodeUtil.handleOneByte(b, cArr, i4);
|
||||
i4++;
|
||||
}
|
||||
int i5 = i4;
|
||||
while (i < i3) {
|
||||
int i6 = i + 1;
|
||||
byte b2 = bArr[i];
|
||||
if (Utf8.DecodeUtil.isOneByte(b2)) {
|
||||
int i7 = i5 + 1;
|
||||
Utf8.DecodeUtil.handleOneByte(b2, cArr, i5);
|
||||
while (i6 < i3) {
|
||||
byte b3 = bArr[i6];
|
||||
if (!Utf8.DecodeUtil.isOneByte(b3)) {
|
||||
break;
|
||||
}
|
||||
i6++;
|
||||
Utf8.DecodeUtil.handleOneByte(b3, cArr, i7);
|
||||
i7++;
|
||||
}
|
||||
i5 = i7;
|
||||
i = i6;
|
||||
} else if (Utf8.DecodeUtil.isTwoBytes(b2)) {
|
||||
if (i6 >= i3) {
|
||||
throw new IllegalArgumentException("Invalid UTF-8");
|
||||
}
|
||||
i += 2;
|
||||
Utf8.DecodeUtil.handleTwoBytes(b2, bArr[i6], cArr, i5);
|
||||
i5++;
|
||||
} else if (Utf8.DecodeUtil.isThreeBytes(b2)) {
|
||||
if (i6 >= i3 - 1) {
|
||||
throw new IllegalArgumentException("Invalid UTF-8");
|
||||
}
|
||||
int i8 = i + 2;
|
||||
i += 3;
|
||||
Utf8.DecodeUtil.handleThreeBytes(b2, bArr[i6], bArr[i8], cArr, i5);
|
||||
i5++;
|
||||
} else {
|
||||
if (i6 >= i3 - 2) {
|
||||
throw new IllegalArgumentException("Invalid UTF-8");
|
||||
}
|
||||
byte b4 = bArr[i6];
|
||||
int i9 = i + 3;
|
||||
byte b5 = bArr[i + 2];
|
||||
i += 4;
|
||||
Utf8.DecodeUtil.handleFourBytes(b2, b4, b5, bArr[i9], cArr, i5);
|
||||
i5 += 2;
|
||||
}
|
||||
}
|
||||
return new String(cArr, 0, i5);
|
||||
}
|
||||
|
||||
public static String decodeUtf8Buffer(ByteBuffer byteBuffer, int i, int i2) {
|
||||
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 (!Utf8.DecodeUtil.isOneByte(b)) {
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
Utf8.DecodeUtil.handleOneByte(b, cArr, i4);
|
||||
i4++;
|
||||
}
|
||||
int i5 = i4;
|
||||
while (i < i3) {
|
||||
int i6 = i + 1;
|
||||
byte b2 = byteBuffer.get(i);
|
||||
if (Utf8.DecodeUtil.isOneByte(b2)) {
|
||||
int i7 = i5 + 1;
|
||||
Utf8.DecodeUtil.handleOneByte(b2, cArr, i5);
|
||||
while (i6 < i3) {
|
||||
byte b3 = byteBuffer.get(i6);
|
||||
if (!Utf8.DecodeUtil.isOneByte(b3)) {
|
||||
break;
|
||||
}
|
||||
i6++;
|
||||
Utf8.DecodeUtil.handleOneByte(b3, cArr, i7);
|
||||
i7++;
|
||||
}
|
||||
i5 = i7;
|
||||
i = i6;
|
||||
} else if (Utf8.DecodeUtil.isTwoBytes(b2)) {
|
||||
if (i6 >= i3) {
|
||||
throw new IllegalArgumentException("Invalid UTF-8");
|
||||
}
|
||||
i += 2;
|
||||
Utf8.DecodeUtil.handleTwoBytes(b2, byteBuffer.get(i6), cArr, i5);
|
||||
i5++;
|
||||
} else if (Utf8.DecodeUtil.isThreeBytes(b2)) {
|
||||
if (i6 >= i3 - 1) {
|
||||
throw new IllegalArgumentException("Invalid UTF-8");
|
||||
}
|
||||
int i8 = i + 2;
|
||||
i += 3;
|
||||
Utf8.DecodeUtil.handleThreeBytes(b2, byteBuffer.get(i6), byteBuffer.get(i8), cArr, i5);
|
||||
i5++;
|
||||
} else {
|
||||
if (i6 >= i3 - 2) {
|
||||
throw new IllegalArgumentException("Invalid UTF-8");
|
||||
}
|
||||
byte b4 = byteBuffer.get(i6);
|
||||
int i9 = i + 3;
|
||||
byte b5 = byteBuffer.get(i + 2);
|
||||
i += 4;
|
||||
Utf8.DecodeUtil.handleFourBytes(b2, b4, b5, byteBuffer.get(i9), cArr, i5);
|
||||
i5 += 2;
|
||||
}
|
||||
}
|
||||
return new String(cArr, 0, i5);
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.Utf8
|
||||
public int encodedLength(CharSequence charSequence) {
|
||||
return computeEncodedLength(charSequence);
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.Utf8
|
||||
public String decodeUtf8(ByteBuffer byteBuffer, int i, int i2) throws IllegalArgumentException {
|
||||
if (byteBuffer.hasArray()) {
|
||||
return decodeUtf8Array(byteBuffer.array(), byteBuffer.arrayOffset() + i, i2);
|
||||
}
|
||||
return decodeUtf8Buffer(byteBuffer, i, i2);
|
||||
}
|
||||
|
||||
private static void encodeUtf8Buffer(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) {
|
||||
throw new ArrayIndexOutOfBoundsException("Failed writing " + charSequence.charAt(i) + " at index " + (byteBuffer.position() + Math.max(i, (position - byteBuffer.position()) + 1)));
|
||||
}
|
||||
}
|
||||
if (i == length) {
|
||||
byteBuffer.position(position + i);
|
||||
return;
|
||||
}
|
||||
position += i;
|
||||
while (i < length) {
|
||||
char charAt2 = charSequence.charAt(i);
|
||||
if (charAt2 < 128) {
|
||||
byteBuffer.put(position, (byte) charAt2);
|
||||
} else if (charAt2 < 2048) {
|
||||
int i2 = position + 1;
|
||||
try {
|
||||
byteBuffer.put(position, (byte) ((charAt2 >>> 6) | 192));
|
||||
byteBuffer.put(i2, (byte) ((charAt2 & '?') | 128));
|
||||
position = i2;
|
||||
} catch (IndexOutOfBoundsException unused2) {
|
||||
position = i2;
|
||||
throw new ArrayIndexOutOfBoundsException("Failed writing " + charSequence.charAt(i) + " at index " + (byteBuffer.position() + Math.max(i, (position - byteBuffer.position()) + 1)));
|
||||
}
|
||||
} else if (charAt2 < 55296 || 57343 < charAt2) {
|
||||
int i3 = position + 1;
|
||||
byteBuffer.put(position, (byte) ((charAt2 >>> '\f') | 224));
|
||||
position += 2;
|
||||
byteBuffer.put(i3, (byte) (((charAt2 >>> 6) & 63) | 128));
|
||||
byteBuffer.put(position, (byte) ((charAt2 & '?') | 128));
|
||||
} else {
|
||||
int i4 = i + 1;
|
||||
if (i4 != length) {
|
||||
try {
|
||||
char charAt3 = charSequence.charAt(i4);
|
||||
if (Character.isSurrogatePair(charAt2, charAt3)) {
|
||||
int codePoint = Character.toCodePoint(charAt2, charAt3);
|
||||
int i5 = position + 1;
|
||||
try {
|
||||
byteBuffer.put(position, (byte) ((codePoint >>> 18) | 240));
|
||||
int i6 = position + 2;
|
||||
try {
|
||||
byteBuffer.put(i5, (byte) (((codePoint >>> 12) & 63) | 128));
|
||||
position += 3;
|
||||
byteBuffer.put(i6, (byte) (((codePoint >>> 6) & 63) | 128));
|
||||
byteBuffer.put(position, (byte) ((codePoint & 63) | 128));
|
||||
i = i4;
|
||||
} catch (IndexOutOfBoundsException unused3) {
|
||||
i = i4;
|
||||
position = i6;
|
||||
throw new ArrayIndexOutOfBoundsException("Failed writing " + charSequence.charAt(i) + " at index " + (byteBuffer.position() + Math.max(i, (position - byteBuffer.position()) + 1)));
|
||||
}
|
||||
} catch (IndexOutOfBoundsException unused4) {
|
||||
position = i5;
|
||||
i = i4;
|
||||
throw new ArrayIndexOutOfBoundsException("Failed writing " + charSequence.charAt(i) + " at index " + (byteBuffer.position() + Math.max(i, (position - byteBuffer.position()) + 1)));
|
||||
}
|
||||
} else {
|
||||
i = i4;
|
||||
}
|
||||
} catch (IndexOutOfBoundsException unused5) {
|
||||
}
|
||||
}
|
||||
throw new UnpairedSurrogateException(i, length);
|
||||
}
|
||||
i++;
|
||||
position++;
|
||||
}
|
||||
byteBuffer.position(position);
|
||||
}
|
||||
|
||||
/* JADX WARN: Code restructure failed: missing block: B:12:0x001d, code lost:
|
||||
|
||||
return r9 + r0;
|
||||
*/
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct add '--show-bad-code' argument
|
||||
*/
|
||||
private static int encodeUtf8Array(java.lang.CharSequence r7, byte[] r8, int r9, int r10) {
|
||||
/*
|
||||
Method dump skipped, instructions count: 251
|
||||
To view this dump add '--comments-level debug' option
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: androidx.emoji2.text.flatbuffer.Utf8Safe.encodeUtf8Array(java.lang.CharSequence, byte[], int, int):int");
|
||||
}
|
||||
|
||||
@Override // androidx.emoji2.text.flatbuffer.Utf8
|
||||
public void encodeUtf8(CharSequence charSequence, ByteBuffer byteBuffer) {
|
||||
if (byteBuffer.hasArray()) {
|
||||
int arrayOffset = byteBuffer.arrayOffset();
|
||||
byteBuffer.position(encodeUtf8Array(charSequence, byteBuffer.array(), byteBuffer.position() + arrayOffset, byteBuffer.remaining()) - arrayOffset);
|
||||
} else {
|
||||
encodeUtf8Buffer(charSequence, byteBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
static class UnpairedSurrogateException extends IllegalArgumentException {
|
||||
UnpairedSurrogateException(int i, int i2) {
|
||||
super("Unpaired surrogate at index " + i + " of " + i2);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user