mirror of
https://github.com/VibedByKaKi/alexandroid.git
synced 2026-11-15 02:17:18 +01:00
101 lines
3 KiB
Java
101 lines
3 KiB
Java
package com.fasterxml.jackson.databind.util;
|
|
|
|
import com.here.time.Duration$$ExternalSyntheticBUOutline0;
|
|
import defpackage.a$$ExternalSyntheticOutline0;
|
|
import rx.Single$$ExternalSyntheticBUOutline0;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
/* loaded from: classes7.dex */
|
|
public abstract class PrimitiveArrayBuilder<T> {
|
|
static final int INITIAL_CHUNK_SIZE = 12;
|
|
static final int MAX_CHUNK_SIZE = 262144;
|
|
static final int SMALL_CHUNK_SIZE = 16384;
|
|
protected Node<T> _bufferHead;
|
|
protected Node<T> _bufferTail;
|
|
protected int _bufferedEntryCount;
|
|
protected T _freeBuffer;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
public static final class Node<T> {
|
|
final T _data;
|
|
final int _dataLength;
|
|
Node<T> _next;
|
|
|
|
public Node(T t, int i) {
|
|
this._data = t;
|
|
this._dataLength = i;
|
|
}
|
|
|
|
public int copyData(T t, int i) {
|
|
System.arraycopy(this._data, 0, t, i, this._dataLength);
|
|
return i + this._dataLength;
|
|
}
|
|
|
|
public T getData() {
|
|
return this._data;
|
|
}
|
|
|
|
public void linkNext(Node<T> node) {
|
|
if (this._next == null) {
|
|
this._next = node;
|
|
} else {
|
|
Duration$$ExternalSyntheticBUOutline0.m$1();
|
|
}
|
|
}
|
|
|
|
public Node<T> next() {
|
|
return this._next;
|
|
}
|
|
}
|
|
|
|
public abstract T _constructArray(int i);
|
|
|
|
public void _reset() {
|
|
Node<T> node = this._bufferTail;
|
|
if (node != null) {
|
|
this._freeBuffer = node.getData();
|
|
}
|
|
this._bufferTail = null;
|
|
this._bufferHead = null;
|
|
this._bufferedEntryCount = 0;
|
|
}
|
|
|
|
public final T appendCompletedChunk(T t, int i) {
|
|
Node<T> node = new Node<>(t, i);
|
|
if (this._bufferHead == null) {
|
|
this._bufferTail = node;
|
|
this._bufferHead = node;
|
|
} else {
|
|
this._bufferTail.linkNext(node);
|
|
this._bufferTail = node;
|
|
}
|
|
this._bufferedEntryCount += i;
|
|
return _constructArray(i < 16384 ? i + i : i + (i >> 2));
|
|
}
|
|
|
|
public int bufferedSize() {
|
|
return this._bufferedEntryCount;
|
|
}
|
|
|
|
public T completeAndClearBuffer(T t, int i) {
|
|
int i2 = this._bufferedEntryCount + i;
|
|
T _constructArray = _constructArray(i2);
|
|
int i3 = 0;
|
|
for (Node<T> node = this._bufferHead; node != null; node = node.next()) {
|
|
i3 = node.copyData(_constructArray, i3);
|
|
}
|
|
System.arraycopy(t, 0, _constructArray, i3, i);
|
|
int i4 = i3 + i;
|
|
if (i4 == i2) {
|
|
return _constructArray;
|
|
}
|
|
Single$$ExternalSyntheticBUOutline0.m$2(a$$ExternalSyntheticOutline0.m("Should have gotten ", i2, " entries, got ", i4));
|
|
return null;
|
|
}
|
|
|
|
public T resetAndStart() {
|
|
_reset();
|
|
T t = this._freeBuffer;
|
|
return t == null ? _constructArray(12) : t;
|
|
}
|
|
}
|