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

134 lines
4 KiB
Java

package com.fasterxml.jackson.databind.util;
import defpackage.a$$ExternalSyntheticOutline0;
import java.lang.reflect.Array;
import java.util.List;
import rx.Single$$ExternalSyntheticBUOutline0;
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
/* loaded from: classes7.dex */
public final class ObjectBuffer {
private static final int MAX_CHUNK = 262144;
private static final int SMALL_CHUNK = 16384;
private Object[] _freeBuffer;
private LinkedNode<Object[]> _head;
private int _size;
private LinkedNode<Object[]> _tail;
public final void _copyTo(Object obj, int i, Object[] objArr, int i2) {
int i3 = 0;
for (LinkedNode<Object[]> linkedNode = this._head; linkedNode != null; linkedNode = linkedNode.next()) {
Object[] value = linkedNode.value();
int length = value.length;
System.arraycopy(value, 0, obj, i3, length);
i3 += length;
}
System.arraycopy(objArr, 0, obj, i3, i2);
int i4 = i3 + i2;
if (i4 == i) {
return;
}
Single$$ExternalSyntheticBUOutline0.m$2(a$$ExternalSyntheticOutline0.m("Should have gotten ", i, " entries, got ", i4));
}
public void _reset() {
LinkedNode<Object[]> linkedNode = this._tail;
if (linkedNode != null) {
this._freeBuffer = linkedNode.value();
}
this._tail = null;
this._head = null;
this._size = 0;
}
public Object[] appendCompletedChunk(Object[] objArr) {
LinkedNode<Object[]> linkedNode = new LinkedNode<>(objArr, null);
if (this._head == null) {
this._tail = linkedNode;
this._head = linkedNode;
} else {
this._tail.linkNext(linkedNode);
this._tail = linkedNode;
}
int length = objArr.length;
this._size += length;
if (length < 16384) {
length += length;
} else if (length < 262144) {
length += length >> 2;
}
return new Object[length];
}
public int bufferedSize() {
return this._size;
}
public void completeAndClearBuffer(Object[] objArr, int i, List<Object> list) {
int i2;
LinkedNode<Object[]> linkedNode = this._head;
while (true) {
i2 = 0;
if (linkedNode == null) {
break;
}
Object[] value = linkedNode.value();
int length = value.length;
while (i2 < length) {
list.add(value[i2]);
i2++;
}
linkedNode = linkedNode.next();
}
while (i2 < i) {
list.add(objArr[i2]);
i2++;
}
_reset();
}
public int initialCapacity() {
Object[] objArr = this._freeBuffer;
if (objArr == null) {
return 0;
}
return objArr.length;
}
public Object[] resetAndStart(Object[] objArr, int i) {
_reset();
Object[] objArr2 = this._freeBuffer;
if (objArr2 == null || objArr2.length < i) {
this._freeBuffer = new Object[Math.max(12, i)];
}
System.arraycopy(objArr, 0, this._freeBuffer, 0, i);
return this._freeBuffer;
}
public Object[] resetAndStart() {
_reset();
Object[] objArr = this._freeBuffer;
if (objArr != null) {
return objArr;
}
Object[] objArr2 = new Object[12];
this._freeBuffer = objArr2;
return objArr2;
}
public <T> T[] completeAndClearBuffer(Object[] objArr, int i, Class<T> cls) {
int i2 = this._size + i;
T[] tArr = (T[]) ((Object[]) Array.newInstance((Class<?>) cls, i2));
_copyTo(tArr, i2, objArr, i);
_reset();
return tArr;
}
public Object[] completeAndClearBuffer(Object[] objArr, int i) {
int i2 = this._size + i;
Object[] objArr2 = new Object[i2];
_copyTo(objArr2, i2, objArr, i);
_reset();
return objArr2;
}
}