what-the-bank/sources/okhttp3/repackaged/internal/DiskLruCache.java

1443 lines
48 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package okhttp3.repackaged.internal;
import android.graphics.PointF;
import android.os.Process;
import android.text.TextUtils;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewConfiguration;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.pingan.ai.p;
import java.io.Closeable;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.Flushable;
import java.io.IOException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.NoSuchElementException;
import java.util.concurrent.Executor;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.regex.Pattern;
import o.C15145giV;
import o.Nhs;
import o.giM;
import o.giO;
import o.giX;
import o.giY;
import o.giZ;
import o.xzZ;
import okhttp3.repackaged.internal.io.FileSystem;
/* loaded from: classes6.dex */
public final class DiskLruCache implements Closeable, Flushable {
static final boolean $assertionsDisabled = false;
static final long ANY_SEQUENCE_NUMBER = -1;
private static final String DIRTY = "DIRTY";
static final String JOURNAL_FILE = "journal";
static final String JOURNAL_FILE_BACKUP = "journal.bkp";
static final String JOURNAL_FILE_TEMP = "journal.tmp";
static final Pattern LEGAL_KEY_PATTERN;
static final String MAGIC = "libcore.io.DiskLruCache";
private static final String READ = "READ";
static final String VERSION_1 = "1";
private static int a = 0;
private static final String aiO = "CLEAN";
private static final String aiP = "REMOVE";
private static final giX aiY;
private static char c;
private static int d;
private static long e;
private final Executor ahj;
private final FileSystem aiQ;
private final File aiR;
private final File aiS;
private final File aiT;
private final int aiU;
private long aiV;
private giO aiW;
private boolean closed;
private final File directory;
private boolean hasJournalErrors;
private boolean initialized;
private boolean mostRecentTrimFailed;
private int redundantOpCount;
private final int valueCount;
private static final byte[] $$a = {101, -49, 33, 116};
private static final int $$b = 74;
private static int $10 = 0;
private static int $11 = 1;
private static int b = 1;
private long size = 0;
private final LinkedHashMap<String, a> lruEntries = new LinkedHashMap<>(0, 0.75f, true);
private long aiX = 0;
private final Runnable ahm = new Runnable(this) { // from class: okhttp3.repackaged.internal.DiskLruCache.1
final DiskLruCache aiZ;
{
this.aiZ = this;
}
@Override // java.lang.Runnable
public void run() {
synchronized (this.aiZ) {
if ((!DiskLruCache.a(this.aiZ)) || DiskLruCache.b(this.aiZ)) {
return;
}
try {
DiskLruCache.c(this.aiZ);
} catch (IOException unused) {
DiskLruCache.a(this.aiZ, true);
}
try {
if (DiskLruCache.d(this.aiZ)) {
DiskLruCache.e(this.aiZ);
DiskLruCache.a(this.aiZ, 0);
}
} catch (IOException e2) {
throw new RuntimeException(e2);
}
}
}
};
/* JADX WARN: Removed duplicated region for block: B:10:0x0026 */
/* JADX WARN: Removed duplicated region for block: B:7:0x001e */
/* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:10:0x0026 -> B:4:0x002b). Please report as a decompilation issue!!! */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
private static void k(int r6, short r7, int r8, java.lang.Object[] r9) {
/*
byte[] r0 = okhttp3.repackaged.internal.DiskLruCache.$$a
int r7 = r7 * 4
int r7 = 4 - r7
int r6 = r6 * 2
int r1 = 1 - r6
int r8 = r8 + 114
byte[] r1 = new byte[r1]
r2 = 0
int r6 = 0 - r6
if (r0 != 0) goto L16
r3 = r6
r4 = r2
goto L2b
L16:
r3 = r2
L17:
byte r4 = (byte) r8
r1[r3] = r4
int r4 = r3 + 1
if (r3 != r6) goto L26
java.lang.String r6 = new java.lang.String
r6.<init>(r1, r2)
r9[r2] = r6
return
L26:
r3 = r0[r7]
r5 = r3
r3 = r8
r8 = r5
L2b:
int r8 = -r8
int r7 = r7 + 1
int r8 = r8 + r3
r3 = r4
goto L17
*/
throw new UnsupportedOperationException("Method not decompiled: okhttp3.repackaged.internal.DiskLruCache.k(int, short, int, java.lang.Object[]):void");
}
static /* synthetic */ int a(DiskLruCache diskLruCache, int i) {
int i2 = 2 % 2;
int i3 = b + 65;
int i4 = i3 % 128;
a = i4;
int i5 = i3 % 2;
diskLruCache.redundantOpCount = i;
int i6 = i4 + 67;
b = i6 % 128;
if (i6 % 2 != 0) {
return i;
}
throw null;
}
static /* synthetic */ Editor a(DiskLruCache diskLruCache, String str, long j) throws IOException {
int i = 2 % 2;
int i2 = b + 83;
a = i2 % 128;
if (i2 % 2 == 0) {
return diskLruCache.a(str, j);
}
diskLruCache.a(str, j);
Object obj = null;
obj.hashCode();
throw null;
}
static /* synthetic */ void a(DiskLruCache diskLruCache, Editor editor, boolean z) throws IOException {
int i = 2 % 2;
int i2 = a + 85;
b = i2 % 128;
int i3 = i2 % 2;
diskLruCache.a(editor, z);
int i4 = b + 7;
a = i4 % 128;
int i5 = i4 % 2;
}
static /* synthetic */ boolean a(DiskLruCache diskLruCache) {
int i = 2 % 2;
int i2 = a;
int i3 = i2 + 1;
b = i3 % 128;
int i4 = i3 % 2;
boolean z = diskLruCache.initialized;
int i5 = i2 + 5;
b = i5 % 128;
if (i5 % 2 == 0) {
int i6 = 96 / 0;
}
return z;
}
static /* synthetic */ boolean a(DiskLruCache diskLruCache, a aVar) throws IOException {
int i = 2 % 2;
int i2 = a + 119;
b = i2 % 128;
if (i2 % 2 != 0) {
return diskLruCache.a(aVar);
}
diskLruCache.a(aVar);
Object obj = null;
obj.hashCode();
throw null;
}
static /* synthetic */ boolean a(DiskLruCache diskLruCache, boolean z) {
int i = 2 % 2;
int i2 = a + 73;
int i3 = i2 % 128;
b = i3;
int i4 = i2 % 2;
diskLruCache.mostRecentTrimFailed = z;
int i5 = i3 + 21;
a = i5 % 128;
if (i5 % 2 == 0) {
return z;
}
Object obj = null;
obj.hashCode();
throw null;
}
static /* synthetic */ boolean b(DiskLruCache diskLruCache) {
int i = 2 % 2;
int i2 = b + 17;
int i3 = i2 % 128;
a = i3;
int i4 = i2 % 2;
boolean z = diskLruCache.closed;
int i5 = i3 + 83;
b = i5 % 128;
int i6 = i5 % 2;
return z;
}
static /* synthetic */ boolean b(DiskLruCache diskLruCache, boolean z) {
int i = 2 % 2;
int i2 = b;
int i3 = i2 + 7;
a = i3 % 128;
int i4 = i3 % 2;
diskLruCache.hasJournalErrors = z;
int i5 = i2 + 71;
a = i5 % 128;
if (i5 % 2 != 0) {
int i6 = 34 / 0;
}
return z;
}
static /* synthetic */ void c(DiskLruCache diskLruCache) throws IOException {
int i = 2 % 2;
int i2 = b + 61;
a = i2 % 128;
int i3 = i2 % 2;
diskLruCache.trimToSize();
if (i3 != 0) {
int i4 = 96 / 0;
}
int i5 = a + 45;
b = i5 % 128;
if (i5 % 2 == 0) {
int i6 = 69 / 0;
}
}
static /* synthetic */ boolean d(DiskLruCache diskLruCache) {
int i = 2 % 2;
int i2 = a + 63;
b = i2 % 128;
int i3 = i2 % 2;
boolean journalRebuildRequired = diskLruCache.journalRebuildRequired();
int i4 = a + 85;
b = i4 % 128;
if (i4 % 2 != 0) {
return journalRebuildRequired;
}
throw null;
}
static /* synthetic */ void e(DiskLruCache diskLruCache) throws IOException {
int i = 2 % 2;
int i2 = a + 85;
b = i2 % 128;
int i3 = i2 % 2;
diskLruCache.rebuildJournal();
int i4 = b + 19;
a = i4 % 128;
int i5 = i4 % 2;
}
static /* synthetic */ LinkedHashMap f(DiskLruCache diskLruCache) {
int i = 2 % 2;
int i2 = a;
int i3 = i2 + 95;
b = i3 % 128;
int i4 = i3 % 2;
LinkedHashMap<String, a> linkedHashMap = diskLruCache.lruEntries;
int i5 = i2 + 67;
b = i5 % 128;
if (i5 % 2 != 0) {
return linkedHashMap;
}
throw null;
}
static /* synthetic */ int g(DiskLruCache diskLruCache) {
int i = 2 % 2;
int i2 = a;
int i3 = i2 + 63;
b = i3 % 128;
int i4 = i3 % 2;
int i5 = diskLruCache.valueCount;
if (i4 == 0) {
int i6 = 18 / 0;
}
int i7 = i2 + 33;
b = i7 % 128;
int i8 = i7 % 2;
return i5;
}
static /* synthetic */ FileSystem h(DiskLruCache diskLruCache) {
int i = 2 % 2;
int i2 = a;
int i3 = i2 + 13;
b = i3 % 128;
int i4 = i3 % 2;
FileSystem fileSystem = diskLruCache.aiQ;
if (i4 == 0) {
throw null;
}
int i5 = i2 + 9;
b = i5 % 128;
int i6 = i5 % 2;
return fileSystem;
}
static /* synthetic */ File i(DiskLruCache diskLruCache) {
int i = 2 % 2;
int i2 = b + 119;
int i3 = i2 % 128;
a = i3;
int i4 = i2 % 2;
File file = diskLruCache.directory;
int i5 = i3 + 109;
b = i5 % 128;
if (i5 % 2 != 0) {
return file;
}
throw null;
}
static {
a = 0;
e();
LEGAL_KEY_PATTERN = Pattern.compile("[a-z0-9_-]{1,120}");
aiY = new giX() { // from class: okhttp3.repackaged.internal.DiskLruCache.4
@Override // o.giX, java.io.Closeable, java.lang.AutoCloseable
public final void close() throws IOException {
}
@Override // o.giX, java.io.Flushable
public final void flush() throws IOException {
}
@Override // o.giX
public final void write(giM gim, long j) throws IOException {
gim.f(j);
}
@Override // o.giX
public final giY timeout() {
return giY.NONE;
}
};
int i = b + 1;
a = i % 128;
int i2 = i % 2;
}
private static void j(char c2, int i, char[] cArr, char[] cArr2, char[] cArr3, Object[] objArr) {
int i2;
int i3 = 2;
int i4 = 2 % 2;
Nhs nhs = new Nhs();
int length = cArr.length;
char[] cArr4 = new char[length];
int length2 = cArr3.length;
char[] cArr5 = new char[length2];
int i5 = 0;
System.arraycopy(cArr, 0, cArr4, 0, length);
System.arraycopy(cArr3, 0, cArr5, 0, length2);
cArr4[0] = (char) (cArr4[0] ^ c2);
cArr5[2] = (char) (cArr5[2] + ((char) i));
int length3 = cArr2.length;
char[] cArr6 = new char[length3];
nhs.a = 0;
int i6 = $10 + 71;
$11 = i6 % 128;
int i7 = i6 % 2;
while (nhs.a < length3) {
int i8 = $10 + 91;
$11 = i8 % 128;
int i9 = i8 % i3;
try {
Object[] objArr2 = {nhs};
Object obj = xzZ.y.get(263693715);
if (obj == null) {
Class cls = (Class) xzZ.c((ViewConfiguration.getScrollDefaultDelay() >> 16) + 45, (ViewConfiguration.getTapTimeout() >> 16) + 5, (char) (ViewConfiguration.getWindowTouchSlop() >> 8));
Class<?>[] clsArr = new Class[1];
clsArr[i5] = Object.class;
obj = cls.getMethod("t", clsArr);
xzZ.y.put(263693715, obj);
}
int intValue = ((Integer) ((Method) obj).invoke(null, objArr2)).intValue();
Object[] objArr3 = {nhs};
Object obj2 = xzZ.y.get(-484664112);
if (obj2 == null) {
Class cls2 = (Class) xzZ.c(352 - (ViewConfiguration.getKeyRepeatDelay() >> 16), (ViewConfiguration.getScrollBarFadeDuration() >> 16) + 5, (char) (TextUtils.getOffsetAfter("", i5) + 52128));
byte b2 = (byte) i5;
byte b3 = b2;
Object[] objArr4 = new Object[1];
k(b2, b3, (byte) (b3 + 1), objArr4);
String str = (String) objArr4[i5];
Class<?>[] clsArr2 = new Class[1];
clsArr2[i5] = Object.class;
obj2 = cls2.getMethod(str, clsArr2);
xzZ.y.put(-484664112, obj2);
}
int intValue2 = ((Integer) ((Method) obj2).invoke(null, objArr3)).intValue();
int i10 = cArr4[nhs.a % 4] * 32718;
Object[] objArr5 = new Object[3];
objArr5[2] = Integer.valueOf(cArr5[intValue]);
objArr5[1] = Integer.valueOf(i10);
objArr5[i5] = nhs;
Object obj3 = xzZ.y.get(430099516);
if (obj3 == null) {
Class cls3 = (Class) xzZ.c(TextUtils.getCapsMode("", i5, i5) + 748, 5 - Gravity.getAbsoluteGravity(i5, i5), (char) (ViewConfiguration.getTouchSlop() >> 8));
Class<?>[] clsArr3 = new Class[3];
clsArr3[i5] = Object.class;
clsArr3[1] = Integer.TYPE;
clsArr3[2] = Integer.TYPE;
obj3 = cls3.getMethod(p.a, clsArr3);
xzZ.y.put(430099516, obj3);
}
((Method) obj3).invoke(null, objArr5);
int i11 = cArr4[intValue2] * 32718;
Object[] objArr6 = new Object[2];
objArr6[1] = Integer.valueOf(cArr5[intValue]);
objArr6[i5] = Integer.valueOf(i11);
Object obj4 = xzZ.y.get(1019894806);
if (obj4 != null) {
i2 = 2;
} else {
Class cls4 = (Class) xzZ.c(((byte) KeyEvent.getModifierMetaStateMask()) + 403, 5 - View.MeasureSpec.makeMeasureSpec(i5, i5), (char) (TextUtils.getCapsMode("", i5, i5) + 21608));
byte b4 = (byte) i5;
byte b5 = b4;
Object[] objArr7 = new Object[1];
k(b4, b5, b5, objArr7);
String str2 = (String) objArr7[i5];
i2 = 2;
Class<?>[] clsArr4 = new Class[2];
clsArr4[i5] = Integer.TYPE;
clsArr4[1] = Integer.TYPE;
obj4 = cls4.getMethod(str2, clsArr4);
xzZ.y.put(1019894806, obj4);
}
cArr5[intValue2] = ((Character) ((Method) obj4).invoke(null, objArr6)).charValue();
cArr4[intValue2] = nhs.c;
cArr6[nhs.a] = (char) ((((int) (d ^ 9051040786702654117L)) ^ ((cArr4[intValue2] ^ cArr2[nhs.a]) ^ (e ^ 9051040786702654117L))) ^ ((char) (c ^ 9051040786702654117L)));
nhs.a++;
i3 = i2;
i5 = 0;
} catch (Throwable th) {
Throwable cause = th.getCause();
if (cause == null) {
throw th;
}
throw cause;
}
}
objArr[0] = new String(cArr6);
}
DiskLruCache(FileSystem fileSystem, File file, int i, int i2, long j, Executor executor) {
this.aiQ = fileSystem;
this.directory = file;
this.aiU = i;
this.aiR = new File(file, JOURNAL_FILE);
this.aiS = new File(file, JOURNAL_FILE_TEMP);
this.aiT = new File(file, JOURNAL_FILE_BACKUP);
this.valueCount = i2;
this.aiV = j;
this.ahj = executor;
}
public final void initialize() throws IOException {
synchronized (this) {
if (this.initialized) {
return;
}
if (this.aiQ.exists(this.aiT)) {
if (this.aiQ.exists(this.aiR)) {
this.aiQ.delete(this.aiT);
} else {
this.aiQ.rename(this.aiT, this.aiR);
}
}
if (this.aiQ.exists(this.aiR)) {
try {
ut();
uv();
this.initialized = true;
return;
} catch (IOException e2) {
Platform platform = Platform.get();
StringBuilder sb = new StringBuilder("DiskLruCache ");
sb.append(this.directory);
sb.append(" is corrupt: ");
sb.append(e2.getMessage());
sb.append(", removing");
platform.logW(sb.toString());
delete();
this.closed = false;
}
}
rebuildJournal();
this.initialized = true;
}
}
public static DiskLruCache create(FileSystem fileSystem, File file, int i, int i2, long j) {
int i3 = 2 % 2;
int i4 = a + 69;
int i5 = i4 % 128;
b = i5;
int i6 = i4 % 2;
if (j <= 0) {
throw new IllegalArgumentException("maxSize <= 0");
}
int i7 = i5 + 105;
a = i7 % 128;
int i8 = i7 % 2;
if (i2 <= 0) {
throw new IllegalArgumentException("valueCount <= 0");
}
return new DiskLruCache(fileSystem, file, i, i2, j, new ThreadPoolExecutor(0, 1, 60L, TimeUnit.SECONDS, new LinkedBlockingQueue(), Util.threadFactory("OkHttp DiskLruCache", true)));
}
/* JADX WARN: Code restructure failed: missing block: B:32:0x00ac, code lost:
if (java.lang.Integer.toString(r18.valueCount).equals(r7) != false) goto L18;
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
private void ut() throws java.io.IOException {
/*
Method dump skipped, instructions count: 296
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: okhttp3.repackaged.internal.DiskLruCache.ut():void");
}
private giO uu() throws FileNotFoundException {
int i = 2 % 2;
giO e2 = C15145giV.e(new okhttp3.repackaged.internal.a(this, this.aiQ.appendingSink(this.aiR)) { // from class: okhttp3.repackaged.internal.DiskLruCache.2
static final boolean $assertionsDisabled = false;
final DiskLruCache aiZ;
{
this.aiZ = this;
}
@Override // okhttp3.repackaged.internal.a
protected void onException(IOException iOException) {
DiskLruCache.b(this.aiZ, true);
}
});
int i2 = a + 75;
b = i2 % 128;
int i3 = i2 % 2;
return e2;
}
/* JADX WARN: Code restructure failed: missing block: B:37:0x0036, code lost:
r5 = r11.substring(r5);
*/
/* JADX WARN: Code restructure failed: missing block: B:38:0x003b, code lost:
if (r2 != 6) goto L22;
*/
/* JADX WARN: Code restructure failed: missing block: B:39:0x003d, code lost:
r8 = okhttp3.repackaged.internal.DiskLruCache.a + 1;
okhttp3.repackaged.internal.DiskLruCache.b = r8 % 128;
r8 = r8 % 2;
*/
/* JADX WARN: Code restructure failed: missing block: B:40:0x004b, code lost:
if (r11.startsWith(okhttp3.repackaged.internal.DiskLruCache.aiP) == false) goto L22;
*/
/* JADX WARN: Code restructure failed: missing block: B:41:0x004d, code lost:
r11 = okhttp3.repackaged.internal.DiskLruCache.a + 117;
okhttp3.repackaged.internal.DiskLruCache.b = r11 % 128;
*/
/* JADX WARN: Code restructure failed: missing block: B:42:0x0056, code lost:
if ((r11 % 2) == 0) goto L19;
*/
/* JADX WARN: Code restructure failed: missing block: B:43:0x0058, code lost:
r10.lruEntries.remove(r5);
*/
/* JADX WARN: Code restructure failed: missing block: B:44:0x005d, code lost:
return;
*/
/* JADX WARN: Code restructure failed: missing block: B:45:0x005e, code lost:
r10.lruEntries.remove(r5);
r7.hashCode();
*/
/* JADX WARN: Code restructure failed: missing block: B:46:0x0066, code lost:
throw null;
*/
/* JADX WARN: Code restructure failed: missing block: B:48:0x0034, code lost:
if (r1 == (-1)) goto L11;
*/
/* JADX WARN: Code restructure failed: missing block: B:6:0x002b, code lost:
if (r1 == (-1)) goto L11;
*/
/* JADX WARN: Code restructure failed: missing block: B:7:0x0067, code lost:
r5 = r11.substring(r5, r1);
r8 = okhttp3.repackaged.internal.DiskLruCache.a + 109;
okhttp3.repackaged.internal.DiskLruCache.b = r8 % 128;
r8 = r8 % 2;
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
private void aY(java.lang.String r11) throws java.io.IOException {
/*
Method dump skipped, instructions count: 251
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: okhttp3.repackaged.internal.DiskLruCache.aY(java.lang.String):void");
}
/* JADX WARN: Removed duplicated region for block: B:12:0x0055 A[LOOP:1: B:10:0x0051->B:12:0x0055, LOOP_END] */
/* JADX WARN: Removed duplicated region for block: B:19:0x006b A[LOOP:2: B:17:0x0067->B:19:0x006b, LOOP_END] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
private void uv() throws java.io.IOException {
/*
r9 = this;
r0 = 2
int r1 = r0 % r0
int r1 = okhttp3.repackaged.internal.DiskLruCache.b
int r1 = r1 + 41
int r2 = r1 % 128
okhttp3.repackaged.internal.DiskLruCache.a = r2
int r1 = r1 % r0
okhttp3.repackaged.internal.io.FileSystem r1 = r9.aiQ
java.io.File r2 = r9.aiS
r1.delete(r2)
java.util.LinkedHashMap<java.lang.String, okhttp3.repackaged.internal.DiskLruCache$a> r1 = r9.lruEntries
java.util.Collection r1 = r1.values()
java.util.Iterator r1 = r1.iterator()
int r2 = okhttp3.repackaged.internal.DiskLruCache.b
int r2 = r2 + 87
int r3 = r2 % 128
okhttp3.repackaged.internal.DiskLruCache.a = r3
int r2 = r2 % r0
L26:
boolean r2 = r1.hasNext()
if (r2 == 0) goto L88
int r2 = okhttp3.repackaged.internal.DiskLruCache.a
int r2 = r2 + 37
int r3 = r2 % 128
okhttp3.repackaged.internal.DiskLruCache.b = r3
int r2 = r2 % r0
r3 = 0
if (r2 != 0) goto L45
java.lang.Object r2 = r1.next()
okhttp3.repackaged.internal.DiskLruCache$a r2 = (okhttp3.repackaged.internal.DiskLruCache.a) r2
okhttp3.repackaged.internal.DiskLruCache$Editor r4 = okhttp3.repackaged.internal.DiskLruCache.a.b(r2)
if (r4 != 0) goto L63
goto L51
L45:
java.lang.Object r2 = r1.next()
okhttp3.repackaged.internal.DiskLruCache$a r2 = (okhttp3.repackaged.internal.DiskLruCache.a) r2
okhttp3.repackaged.internal.DiskLruCache$Editor r4 = okhttp3.repackaged.internal.DiskLruCache.a.b(r2)
if (r4 != 0) goto L63
L51:
int r4 = r9.valueCount
if (r3 >= r4) goto L26
long r4 = r9.size
long[] r6 = okhttp3.repackaged.internal.DiskLruCache.a.c(r2)
r7 = r6[r3]
long r4 = r4 + r7
r9.size = r4
int r3 = r3 + 1
goto L51
L63:
r4 = 0
okhttp3.repackaged.internal.DiskLruCache.a.a(r2, r4)
L67:
int r4 = r9.valueCount
if (r3 >= r4) goto L84
okhttp3.repackaged.internal.io.FileSystem r4 = r9.aiQ
java.io.File[] r5 = okhttp3.repackaged.internal.DiskLruCache.a.d(r2)
r5 = r5[r3]
r4.delete(r5)
okhttp3.repackaged.internal.io.FileSystem r4 = r9.aiQ
java.io.File[] r5 = okhttp3.repackaged.internal.DiskLruCache.a.e(r2)
r5 = r5[r3]
r4.delete(r5)
int r3 = r3 + 1
goto L67
L84:
r1.remove()
goto L26
L88:
return
*/
throw new UnsupportedOperationException("Method not decompiled: okhttp3.repackaged.internal.DiskLruCache.uv():void");
}
private void rebuildJournal() throws IOException {
synchronized (this) {
giO gio = this.aiW;
if (gio != null) {
gio.close();
}
giO e2 = C15145giV.e(this.aiQ.sink(this.aiS));
try {
e2.c(MAGIC).b(10);
Object[] objArr = new Object[1];
j((char) (((Process.getThreadPriority(0) + 20) >> 6) + 61074), (-1893003446) - (PointF.length(BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED) > BitmapDescriptorFactory.HUE_RED ? 1 : (PointF.length(BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED) == BitmapDescriptorFactory.HUE_RED ? 0 : -1)), new char[]{18996, 11023, 37519, 4078}, new char[]{7544}, new char[]{0, 0, 0, 0}, objArr);
e2.c(((String) objArr[0]).intern()).b(10);
e2.i(this.aiU).b(10);
e2.i(this.valueCount).b(10);
e2.b(10);
for (a aVar : this.lruEntries.values()) {
if (aVar.ajg != null) {
e2.c(DIRTY).b(32);
e2.c(aVar.key);
e2.b(10);
} else {
e2.c(aiO).b(32);
e2.c(aVar.key);
aVar.a(e2);
e2.b(10);
}
}
e2.close();
if (this.aiQ.exists(this.aiR)) {
this.aiQ.rename(this.aiR, this.aiT);
}
this.aiQ.rename(this.aiS, this.aiR);
this.aiQ.delete(this.aiT);
this.aiW = uu();
this.hasJournalErrors = false;
} catch (Throwable th) {
e2.close();
throw th;
}
}
}
public final Snapshot get(String str) throws IOException {
synchronized (this) {
initialize();
uw();
aZ(str);
a aVar = this.lruEntries.get(str);
if (aVar != null && aVar.readable) {
Snapshot uz = aVar.uz();
if (uz == null) {
return null;
}
this.redundantOpCount++;
this.aiW.c(READ).b(32).c(str).b(10);
if (journalRebuildRequired()) {
this.ahj.execute(this.ahm);
}
return uz;
}
return null;
}
}
public final Editor edit(String str) throws IOException {
int i = 2 % 2;
int i2 = a + 103;
b = i2 % 128;
int i3 = i2 % 2;
Editor a2 = a(str, -1L);
int i4 = a + 75;
b = i4 % 128;
int i5 = i4 % 2;
return a2;
}
private Editor a(String str, long j) throws IOException {
synchronized (this) {
initialize();
uw();
aZ(str);
a aVar = this.lruEntries.get(str);
if (j != -1 && (aVar == null || aVar.sequenceNumber != j)) {
return null;
}
if (aVar != null && aVar.ajg != null) {
return null;
}
if (this.mostRecentTrimFailed) {
this.ahj.execute(this.ahm);
return null;
}
this.aiW.c(DIRTY).b(32).c(str).b(10);
this.aiW.flush();
if (this.hasJournalErrors) {
return null;
}
if (aVar == null) {
aVar = new a(str);
this.lruEntries.put(str, aVar);
}
Editor editor = new Editor(aVar);
aVar.ajg = editor;
return editor;
}
}
public final long getMaxSize() {
long j;
synchronized (this) {
j = this.aiV;
}
return j;
}
public final void setMaxSize(long j) {
synchronized (this) {
this.aiV = j;
if (this.initialized) {
this.ahj.execute(this.ahm);
}
}
}
public final long size() throws IOException {
long j;
synchronized (this) {
initialize();
j = this.size;
}
return j;
}
private void a(Editor editor, boolean z) throws IOException {
synchronized (this) {
a aVar = editor.ajc;
if (aVar.ajg != editor) {
throw new IllegalStateException();
}
if (z && !aVar.readable) {
for (int i = 0; i < this.valueCount; i++) {
if (!editor.written[i]) {
editor.abort();
StringBuilder sb = new StringBuilder();
sb.append("Newly created entry didn't create value for index ");
sb.append(i);
throw new IllegalStateException(sb.toString());
}
if (!this.aiQ.exists(aVar.dirtyFiles[i])) {
editor.abort();
return;
}
}
}
for (int i2 = 0; i2 < this.valueCount; i2++) {
File file = aVar.dirtyFiles[i2];
if (z) {
if (this.aiQ.exists(file)) {
File file2 = aVar.cleanFiles[i2];
this.aiQ.rename(file, file2);
long j = aVar.lengths[i2];
long size = this.aiQ.size(file2);
aVar.lengths[i2] = size;
this.size = (this.size - j) + size;
}
} else {
this.aiQ.delete(file);
}
}
this.redundantOpCount++;
aVar.ajg = null;
if (aVar.readable | z) {
aVar.readable = true;
this.aiW.c(aiO).b(32);
this.aiW.c(aVar.key);
aVar.a(this.aiW);
this.aiW.b(10);
if (z) {
long j2 = this.aiX;
this.aiX = 1 + j2;
aVar.sequenceNumber = j2;
}
} else {
this.lruEntries.remove(aVar.key);
this.aiW.c(aiP).b(32);
this.aiW.c(aVar.key);
this.aiW.b(10);
}
this.aiW.flush();
if (this.size > this.aiV || journalRebuildRequired()) {
this.ahj.execute(this.ahm);
}
}
}
private boolean journalRebuildRequired() {
int i;
int i2 = 2 % 2;
int i3 = a + 73;
b = i3 % 128;
if (i3 % 2 != 0 ? (i = this.redundantOpCount) >= 2000 : (i = this.redundantOpCount) >= 21726) {
if (i >= this.lruEntries.size()) {
int i4 = b;
int i5 = i4 + 51;
a = i5 % 128;
int i6 = i5 % 2;
int i7 = i4 + 103;
a = i7 % 128;
if (i7 % 2 != 0) {
int i8 = 3 % 3;
}
return true;
}
}
return false;
}
public final boolean remove(String str) throws IOException {
synchronized (this) {
initialize();
uw();
aZ(str);
a aVar = this.lruEntries.get(str);
if (aVar == null) {
return false;
}
boolean a2 = a(aVar);
if (a2 && this.size <= this.aiV) {
this.mostRecentTrimFailed = false;
}
return a2;
}
}
private boolean a(a aVar) throws IOException {
int i = 2 % 2;
int i2 = a + 81;
b = i2 % 128;
if (i2 % 2 != 0) {
if (aVar.ajg != null) {
aVar.ajg.ajd = true;
}
for (int i3 = 0; i3 < this.valueCount; i3++) {
int i4 = a + 11;
b = i4 % 128;
int i5 = i4 % 2;
this.aiQ.delete(aVar.cleanFiles[i3]);
this.size -= aVar.lengths[i3];
aVar.lengths[i3] = 0;
}
this.redundantOpCount++;
this.aiW.c(aiP).b(32).c(aVar.key).b(10);
this.lruEntries.remove(aVar.key);
if (journalRebuildRequired()) {
this.ahj.execute(this.ahm);
int i6 = a + 33;
b = i6 % 128;
int i7 = i6 % 2;
}
return true;
}
Editor unused = aVar.ajg;
Object obj = null;
obj.hashCode();
throw null;
}
public final boolean isClosed() {
boolean z;
synchronized (this) {
z = this.closed;
}
return z;
}
private void uw() {
synchronized (this) {
if (isClosed()) {
throw new IllegalStateException("cache is closed");
}
}
}
@Override // java.io.Flushable
public final void flush() throws IOException {
synchronized (this) {
if (this.initialized) {
uw();
trimToSize();
this.aiW.flush();
}
}
}
@Override // java.io.Closeable, java.lang.AutoCloseable
public final void close() throws IOException {
synchronized (this) {
if (this.initialized && !this.closed) {
for (a aVar : (a[]) this.lruEntries.values().toArray(new a[this.lruEntries.size()])) {
if (aVar.ajg != null) {
aVar.ajg.abort();
}
}
trimToSize();
this.aiW.close();
this.aiW = null;
this.closed = true;
return;
}
this.closed = true;
}
}
private void trimToSize() throws IOException {
int i = 2 % 2;
while (this.size > this.aiV) {
int i2 = b + 87;
a = i2 % 128;
int i3 = i2 % 2;
a(this.lruEntries.values().iterator().next());
}
this.mostRecentTrimFailed = false;
int i4 = b + 123;
a = i4 % 128;
int i5 = i4 % 2;
}
public final void delete() throws IOException {
int i = 2 % 2;
int i2 = a + 71;
b = i2 % 128;
int i3 = i2 % 2;
close();
this.aiQ.deleteContents(this.directory);
int i4 = b + 59;
a = i4 % 128;
if (i4 % 2 == 0) {
return;
}
Object obj = null;
obj.hashCode();
throw null;
}
public final void evictAll() throws IOException {
synchronized (this) {
initialize();
for (a aVar : (a[]) this.lruEntries.values().toArray(new a[this.lruEntries.size()])) {
a(aVar);
}
this.mostRecentTrimFailed = false;
}
}
private void aZ(String str) {
int i = 2 % 2;
int i2 = a + 37;
b = i2 % 128;
if (i2 % 2 != 0) {
if (LEGAL_KEY_PATTERN.matcher(str).matches()) {
int i3 = b + 79;
a = i3 % 128;
int i4 = i3 % 2;
return;
} else {
StringBuilder sb = new StringBuilder("keys must match regex [a-z0-9_-]{1,120}: \"");
sb.append(str);
sb.append("\"");
throw new IllegalArgumentException(sb.toString());
}
}
LEGAL_KEY_PATTERN.matcher(str).matches();
Object obj = null;
obj.hashCode();
throw null;
}
public final Iterator<Snapshot> snapshots() throws IOException {
Iterator<Snapshot> it;
synchronized (this) {
initialize();
it = new Iterator<Snapshot>(this) { // from class: okhttp3.repackaged.internal.DiskLruCache.3
final DiskLruCache aiZ;
Snapshot aja;
Snapshot ajb;
final Iterator<a> delegate;
{
this.aiZ = this;
this.delegate = new ArrayList(DiskLruCache.f(this).values()).iterator();
}
@Override // java.util.Iterator
public boolean hasNext() {
if (this.aja != null) {
return true;
}
synchronized (this.aiZ) {
if (DiskLruCache.b(this.aiZ)) {
return false;
}
while (this.delegate.hasNext()) {
Snapshot uz = this.delegate.next().uz();
if (uz != null) {
this.aja = uz;
return true;
}
}
return false;
}
}
@Override // java.util.Iterator
/* renamed from: uy, reason: merged with bridge method [inline-methods] */
public Snapshot next() {
if (!hasNext()) {
throw new NoSuchElementException();
}
Snapshot snapshot = this.aja;
this.ajb = snapshot;
this.aja = null;
return snapshot;
}
@Override // java.util.Iterator
public void remove() {
Snapshot snapshot = this.ajb;
if (snapshot == null) {
throw new IllegalStateException("remove() before next()");
}
try {
this.aiZ.remove(snapshot.key);
} catch (IOException unused) {
} catch (Throwable th) {
this.ajb = null;
throw th;
}
this.ajb = null;
}
};
}
return it;
}
/* loaded from: classes6.dex */
public final class Snapshot implements Closeable {
final DiskLruCache aiZ;
private final giZ[] ajh;
private final String key;
private final long[] lengths;
private final long sequenceNumber;
private Snapshot(DiskLruCache diskLruCache, String str, long j, giZ[] gizArr, long[] jArr) {
this.aiZ = diskLruCache;
this.key = str;
this.sequenceNumber = j;
this.ajh = gizArr;
this.lengths = jArr;
}
public final Editor edit() throws IOException {
return DiskLruCache.a(this.aiZ, this.key, this.sequenceNumber);
}
public final giZ getSource(int i) {
return this.ajh[i];
}
public final long getLength(int i) {
return this.lengths[i];
}
@Override // java.io.Closeable, java.lang.AutoCloseable
public final void close() {
for (giZ giz : this.ajh) {
Util.closeQuietly(giz);
}
}
public final String key() {
return this.key;
}
}
/* loaded from: classes6.dex */
public final class Editor {
final DiskLruCache aiZ;
private final a ajc;
private boolean ajd;
private boolean aje;
private final boolean[] written;
private Editor(DiskLruCache diskLruCache, a aVar) {
this.aiZ = diskLruCache;
this.ajc = aVar;
this.written = aVar.readable ? null : new boolean[DiskLruCache.g(diskLruCache)];
}
public final giZ newSource(int i) throws IOException {
synchronized (this.aiZ) {
if (this.ajc.ajg != this) {
throw new IllegalStateException();
}
if (!this.ajc.readable) {
return null;
}
try {
return DiskLruCache.h(this.aiZ).source(this.ajc.cleanFiles[i]);
} catch (FileNotFoundException unused) {
return null;
}
}
}
public final giX newSink(int i) throws IOException {
okhttp3.repackaged.internal.a aVar;
synchronized (this.aiZ) {
if (this.ajc.ajg != this) {
throw new IllegalStateException();
}
if (!this.ajc.readable) {
this.written[i] = true;
}
try {
aVar = new okhttp3.repackaged.internal.a(this, DiskLruCache.h(this.aiZ).sink(this.ajc.dirtyFiles[i])) { // from class: okhttp3.repackaged.internal.DiskLruCache.Editor.1
final Editor ajf;
{
this.ajf = this;
}
@Override // okhttp3.repackaged.internal.a
protected void onException(IOException iOException) {
synchronized (this.ajf.aiZ) {
this.ajf.ajd = true;
}
}
};
} catch (FileNotFoundException unused) {
return DiskLruCache.ux();
}
}
return aVar;
}
public final void commit() throws IOException {
synchronized (this.aiZ) {
if (this.ajd) {
DiskLruCache.a(this.aiZ, this, false);
DiskLruCache.a(this.aiZ, this.ajc);
} else {
DiskLruCache.a(this.aiZ, this, true);
}
this.aje = true;
}
}
public final void abort() throws IOException {
synchronized (this.aiZ) {
DiskLruCache.a(this.aiZ, this, false);
}
}
public final void abortUnlessCommitted() {
synchronized (this.aiZ) {
if (!this.aje) {
try {
DiskLruCache.a(this.aiZ, this, false);
} catch (IOException unused) {
}
}
}
}
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes6.dex */
public final class a {
final DiskLruCache aiZ;
private Editor ajg;
private final File[] cleanFiles;
private final File[] dirtyFiles;
private final String key;
private final long[] lengths;
private boolean readable;
private long sequenceNumber;
private a(DiskLruCache diskLruCache, String str) {
this.aiZ = diskLruCache;
this.key = str;
this.lengths = new long[DiskLruCache.g(diskLruCache)];
this.cleanFiles = new File[DiskLruCache.g(diskLruCache)];
this.dirtyFiles = new File[DiskLruCache.g(diskLruCache)];
StringBuilder sb = new StringBuilder(str);
sb.append('.');
int length = sb.length();
for (int i = 0; i < DiskLruCache.g(diskLruCache); i++) {
sb.append(i);
this.cleanFiles[i] = new File(DiskLruCache.i(diskLruCache), sb.toString());
sb.append(".tmp");
this.dirtyFiles[i] = new File(DiskLruCache.i(diskLruCache), sb.toString());
sb.setLength(length);
}
}
/* JADX INFO: Access modifiers changed from: private */
public void setLengths(String[] strArr) throws IOException {
if (strArr.length != DiskLruCache.g(this.aiZ)) {
throw d(strArr);
}
for (int i = 0; i < strArr.length; i++) {
try {
this.lengths[i] = Long.parseLong(strArr[i]);
} catch (NumberFormatException unused) {
throw d(strArr);
}
}
}
final void a(giO gio) throws IOException {
for (long j : this.lengths) {
gio.b(32).i(j);
}
}
private IOException d(String[] strArr) throws IOException {
StringBuilder sb = new StringBuilder("unexpected journal line: ");
sb.append(Arrays.toString(strArr));
throw new IOException(sb.toString());
}
final Snapshot uz() {
giZ giz;
if (!Thread.holdsLock(this.aiZ)) {
throw new AssertionError();
}
giZ[] gizArr = new giZ[DiskLruCache.g(this.aiZ)];
long[] jArr = (long[]) this.lengths.clone();
for (int i = 0; i < DiskLruCache.g(this.aiZ); i++) {
try {
gizArr[i] = DiskLruCache.h(this.aiZ).source(this.cleanFiles[i]);
} catch (FileNotFoundException unused) {
for (int i2 = 0; i2 < DiskLruCache.g(this.aiZ) && (giz = gizArr[i2]) != null; i2++) {
Util.closeQuietly(giz);
}
return null;
}
}
return new Snapshot(this.key, this.sequenceNumber, gizArr, jArr);
}
}
static void e() {
e = 9051040786702654117L;
d = 452713125;
c = (char) 65277;
}
public final File getDirectory() {
int i = 2 % 2;
int i2 = a;
int i3 = i2 + 95;
b = i3 % 128;
int i4 = i3 % 2;
File file = this.directory;
int i5 = i2 + 9;
b = i5 % 128;
int i6 = i5 % 2;
return file;
}
static /* synthetic */ giX ux() {
int i = 2 % 2;
int i2 = a + 5;
b = i2 % 128;
if (i2 % 2 != 0) {
return aiY;
}
Object obj = null;
obj.hashCode();
throw null;
}
}