mirror of
https://github.com/VibedByKaKi/alexandroid.git
synced 2026-12-03 03:00:23 +01:00
81 lines
2.5 KiB
Java
81 lines
2.5 KiB
Java
package org.codehaus.jackson.util;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
/* loaded from: classes11.dex */
|
|
public class BufferRecycler {
|
|
public static final int DEFAULT_WRITE_CONCAT_BUFFER_LEN = 2000;
|
|
protected final byte[][] _byteBuffers = new byte[ByteBufferType.values().length][];
|
|
protected final char[][] _charBuffers = new char[CharBufferType.values().length][];
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
public enum ByteBufferType {
|
|
READ_IO_BUFFER(4000),
|
|
WRITE_ENCODING_BUFFER(4000),
|
|
WRITE_CONCAT_BUFFER(2000);
|
|
|
|
private final int size;
|
|
|
|
ByteBufferType(int i) {
|
|
this.size = i;
|
|
}
|
|
}
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
public enum CharBufferType {
|
|
TOKEN_BUFFER(2000),
|
|
CONCAT_BUFFER(2000),
|
|
TEXT_BUFFER(200),
|
|
NAME_COPY_BUFFER(200);
|
|
|
|
private final int size;
|
|
|
|
CharBufferType(int i) {
|
|
this.size = i;
|
|
}
|
|
}
|
|
|
|
private final byte[] balloc(int i) {
|
|
return new byte[i];
|
|
}
|
|
|
|
private final char[] calloc(int i) {
|
|
return new char[i];
|
|
}
|
|
|
|
public final byte[] allocByteBuffer(ByteBufferType byteBufferType) {
|
|
int ordinal = byteBufferType.ordinal();
|
|
byte[][] bArr = this._byteBuffers;
|
|
byte[] bArr2 = bArr[ordinal];
|
|
if (bArr2 == null) {
|
|
return balloc(byteBufferType.size);
|
|
}
|
|
bArr[ordinal] = null;
|
|
return bArr2;
|
|
}
|
|
|
|
public final char[] allocCharBuffer(CharBufferType charBufferType, int i) {
|
|
if (charBufferType.size > i) {
|
|
i = charBufferType.size;
|
|
}
|
|
int ordinal = charBufferType.ordinal();
|
|
char[][] cArr = this._charBuffers;
|
|
char[] cArr2 = cArr[ordinal];
|
|
if (cArr2 == null || cArr2.length < i) {
|
|
return calloc(i);
|
|
}
|
|
cArr[ordinal] = null;
|
|
return cArr2;
|
|
}
|
|
|
|
public final void releaseByteBuffer(ByteBufferType byteBufferType, byte[] bArr) {
|
|
this._byteBuffers[byteBufferType.ordinal()] = bArr;
|
|
}
|
|
|
|
public final void releaseCharBuffer(CharBufferType charBufferType, char[] cArr) {
|
|
this._charBuffers[charBufferType.ordinal()] = cArr;
|
|
}
|
|
|
|
public final char[] allocCharBuffer(CharBufferType charBufferType) {
|
|
return allocCharBuffer(charBufferType, 0);
|
|
}
|
|
}
|