1653 lines
58 KiB
Java
1653 lines
58 KiB
Java
package okhttp3.internal.cache;
|
|
|
|
import android.graphics.PointF;
|
|
import android.text.TextUtils;
|
|
import android.util.TypedValue;
|
|
import android.view.Gravity;
|
|
import android.view.ViewConfiguration;
|
|
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
|
|
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.Collection;
|
|
import java.util.Iterator;
|
|
import java.util.LinkedHashMap;
|
|
import java.util.List;
|
|
import kotlin.KotlinNothingValueException;
|
|
import net.sf.scuba.smartcards.ISO7816;
|
|
import o.AbstractC15154gii;
|
|
import o.C14866gag;
|
|
import o.C14953gcr;
|
|
import o.C14957gcv;
|
|
import o.C15017gel;
|
|
import o.C15160gio;
|
|
import o.C4593bdB;
|
|
import o.InterfaceC15148gic;
|
|
import o.InterfaceC15168giw;
|
|
import o.gbF;
|
|
import o.gdW;
|
|
import o.gdZ;
|
|
import o.giD;
|
|
import o.xzZ;
|
|
import okhttp3.internal.Util;
|
|
import okhttp3.internal.cache.DiskLruCache;
|
|
import okhttp3.internal.concurrent.Task;
|
|
import okhttp3.internal.concurrent.TaskQueue;
|
|
import okhttp3.internal.concurrent.TaskRunner;
|
|
import okhttp3.internal.io.FileSystem;
|
|
import okhttp3.internal.platform.Platform;
|
|
|
|
/* loaded from: classes.dex */
|
|
public final class DiskLruCache implements Closeable, Flushable {
|
|
public static final long ANY_SEQUENCE_NUMBER;
|
|
public static final String CLEAN;
|
|
public static final Companion Companion;
|
|
public static final String DIRTY;
|
|
public static final String JOURNAL_FILE;
|
|
public static final String JOURNAL_FILE_BACKUP;
|
|
public static final String JOURNAL_FILE_TEMP;
|
|
public static final gdW LEGAL_KEY_PATTERN;
|
|
public static final String MAGIC;
|
|
public static final String READ;
|
|
public static final String REMOVE;
|
|
public static final String VERSION_1;
|
|
private static int b;
|
|
private static long e;
|
|
private final int appVersion;
|
|
private boolean civilizedFileSystem;
|
|
private final TaskQueue cleanupQueue;
|
|
private final DiskLruCache$cleanupTask$1 cleanupTask;
|
|
private boolean closed;
|
|
private final File directory;
|
|
private final FileSystem fileSystem;
|
|
private boolean hasJournalErrors;
|
|
private boolean initialized;
|
|
private final File journalFile;
|
|
private final File journalFileBackup;
|
|
private final File journalFileTmp;
|
|
private InterfaceC15148gic journalWriter;
|
|
private final LinkedHashMap<String, Entry> lruEntries;
|
|
private long maxSize;
|
|
private boolean mostRecentRebuildFailed;
|
|
private boolean mostRecentTrimFailed;
|
|
private long nextSequenceNumber;
|
|
private int redundantOpCount;
|
|
private long size;
|
|
private final int valueCount;
|
|
private static final byte[] $$a = {ISO7816.INS_MANAGE_CHANNEL, -18, 54, -52};
|
|
private static final int $$b = 49;
|
|
private static int $10 = 0;
|
|
private static int $11 = 1;
|
|
private static int d = 1;
|
|
|
|
/* JADX WARN: Removed duplicated region for block: B:10:0x0022 */
|
|
/* JADX WARN: Removed duplicated region for block: B:7:0x001a */
|
|
/* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:10:0x0022 -> B:4:0x002a). 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 f(byte r6, short r7, byte r8, java.lang.Object[] r9) {
|
|
/*
|
|
int r8 = r8 * 3
|
|
int r0 = r8 + 1
|
|
int r7 = r7 + 77
|
|
int r6 = r6 * 3
|
|
int r6 = r6 + 4
|
|
byte[] r1 = okhttp3.internal.cache.DiskLruCache.$$a
|
|
byte[] r0 = new byte[r0]
|
|
r2 = 0
|
|
if (r1 != 0) goto L14
|
|
r3 = r8
|
|
r4 = r2
|
|
goto L2a
|
|
L14:
|
|
r3 = r2
|
|
L15:
|
|
byte r4 = (byte) r7
|
|
r0[r3] = r4
|
|
if (r3 != r8) goto L22
|
|
java.lang.String r6 = new java.lang.String
|
|
r6.<init>(r0, r2)
|
|
r9[r2] = r6
|
|
return
|
|
L22:
|
|
int r3 = r3 + 1
|
|
r4 = r1[r6]
|
|
r5 = r3
|
|
r3 = r7
|
|
r7 = r4
|
|
r4 = r5
|
|
L2a:
|
|
int r7 = -r7
|
|
int r7 = r7 + r3
|
|
int r6 = r6 + 1
|
|
r3 = r4
|
|
goto L15
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: okhttp3.internal.cache.DiskLruCache.f(byte, short, byte, java.lang.Object[]):void");
|
|
}
|
|
|
|
private static void c(char[] cArr, int i, Object[] objArr) {
|
|
int i2 = 2 % 2;
|
|
C4593bdB c4593bdB = new C4593bdB();
|
|
c4593bdB.a = i;
|
|
int length = cArr.length;
|
|
long[] jArr = new long[length];
|
|
c4593bdB.e = 0;
|
|
while (c4593bdB.e < cArr.length) {
|
|
int i3 = $10 + 43;
|
|
$11 = i3 % 128;
|
|
int i4 = i3 % 2;
|
|
int i5 = c4593bdB.e;
|
|
try {
|
|
Object[] objArr2 = {Integer.valueOf(cArr[c4593bdB.e]), c4593bdB, c4593bdB};
|
|
Object obj = xzZ.y.get(-1229953068);
|
|
if (obj == null) {
|
|
Class cls = (Class) xzZ.c((TypedValue.complexToFloat(0) > BitmapDescriptorFactory.HUE_RED ? 1 : (TypedValue.complexToFloat(0) == BitmapDescriptorFactory.HUE_RED ? 0 : -1)) + 402, 5 - (ViewConfiguration.getTapTimeout() >> 16), (char) ((ViewConfiguration.getPressedStateDuration() >> 16) + 21608));
|
|
byte b2 = (byte) 0;
|
|
byte b3 = b2;
|
|
Object[] objArr3 = new Object[1];
|
|
f(b2, b3, b3, objArr3);
|
|
obj = cls.getMethod((String) objArr3[0], Integer.TYPE, Object.class, Object.class);
|
|
xzZ.y.put(-1229953068, obj);
|
|
}
|
|
jArr[i5] = ((Long) ((Method) obj).invoke(null, objArr2)).longValue() ^ (e ^ (-6958928035870403642L));
|
|
try {
|
|
Object[] objArr4 = {c4593bdB, c4593bdB};
|
|
Object obj2 = xzZ.y.get(-1143917229);
|
|
if (obj2 == null) {
|
|
Class cls2 = (Class) xzZ.c(238 - Gravity.getAbsoluteGravity(0, 0), 5 - (ViewConfiguration.getFadingEdgeLength() >> 16), (char) (ViewConfiguration.getFadingEdgeLength() >> 16));
|
|
byte b4 = (byte) 0;
|
|
byte b5 = (byte) (b4 + 1);
|
|
Object[] objArr5 = new Object[1];
|
|
f(b4, b5, (byte) (b5 - 1), objArr5);
|
|
obj2 = cls2.getMethod((String) objArr5[0], Object.class, Object.class);
|
|
xzZ.y.put(-1143917229, obj2);
|
|
}
|
|
((Method) obj2).invoke(null, objArr4);
|
|
} catch (Throwable th) {
|
|
Throwable cause = th.getCause();
|
|
if (cause == null) {
|
|
throw th;
|
|
}
|
|
throw cause;
|
|
}
|
|
} catch (Throwable th2) {
|
|
Throwable cause2 = th2.getCause();
|
|
if (cause2 == null) {
|
|
throw th2;
|
|
}
|
|
throw cause2;
|
|
}
|
|
}
|
|
char[] cArr2 = new char[length];
|
|
c4593bdB.e = 0;
|
|
while (c4593bdB.e < cArr.length) {
|
|
int i6 = $10 + 105;
|
|
$11 = i6 % 128;
|
|
int i7 = i6 % 2;
|
|
cArr2[c4593bdB.e] = (char) jArr[c4593bdB.e];
|
|
try {
|
|
Object[] objArr6 = {c4593bdB, c4593bdB};
|
|
Object obj3 = xzZ.y.get(-1143917229);
|
|
if (obj3 == null) {
|
|
Class cls3 = (Class) xzZ.c(TextUtils.indexOf((CharSequence) "", '0', 0) + 239, (ViewConfiguration.getKeyRepeatDelay() >> 16) + 5, (char) ((ViewConfiguration.getGlobalActionKeyTimeout() > 0L ? 1 : (ViewConfiguration.getGlobalActionKeyTimeout() == 0L ? 0 : -1)) - 1));
|
|
byte b6 = (byte) 0;
|
|
byte b7 = (byte) (b6 + 1);
|
|
Object[] objArr7 = new Object[1];
|
|
f(b6, b7, (byte) (b7 - 1), objArr7);
|
|
obj3 = cls3.getMethod((String) objArr7[0], Object.class, Object.class);
|
|
xzZ.y.put(-1143917229, obj3);
|
|
}
|
|
((Method) obj3).invoke(null, objArr6);
|
|
} catch (Throwable th3) {
|
|
Throwable cause3 = th3.getCause();
|
|
if (cause3 == null) {
|
|
throw th3;
|
|
}
|
|
throw cause3;
|
|
}
|
|
}
|
|
String str = new String(cArr2);
|
|
int i8 = $10 + 97;
|
|
$11 = i8 % 128;
|
|
if (i8 % 2 != 0) {
|
|
objArr[0] = str;
|
|
} else {
|
|
Object obj4 = null;
|
|
obj4.hashCode();
|
|
throw null;
|
|
}
|
|
}
|
|
|
|
/* JADX WARN: Type inference failed for: r3v3, types: [okhttp3.internal.cache.DiskLruCache$cleanupTask$1] */
|
|
public DiskLruCache(FileSystem fileSystem, File file, int i, int i2, long j, TaskRunner taskRunner) {
|
|
C14957gcv.e(fileSystem, "");
|
|
C14957gcv.e(file, "");
|
|
C14957gcv.e(taskRunner, "");
|
|
this.fileSystem = fileSystem;
|
|
this.directory = file;
|
|
this.appVersion = i;
|
|
this.valueCount = i2;
|
|
this.maxSize = j;
|
|
this.lruEntries = new LinkedHashMap<>(0, 0.75f, true);
|
|
this.cleanupQueue = taskRunner.newQueue();
|
|
this.cleanupTask = new Task(this, C14957gcv.c(Util.okHttpName, (Object) " Cache")) { // from class: okhttp3.internal.cache.DiskLruCache$cleanupTask$1
|
|
final DiskLruCache this$0;
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
{
|
|
this.this$0 = this;
|
|
}
|
|
|
|
@Override // okhttp3.internal.concurrent.Task
|
|
public final long runOnce() {
|
|
DiskLruCache diskLruCache = this.this$0;
|
|
synchronized (diskLruCache) {
|
|
if (!DiskLruCache.access$getInitialized$p(diskLruCache) || diskLruCache.getClosed$okhttp()) {
|
|
return -1L;
|
|
}
|
|
try {
|
|
diskLruCache.trimToSize();
|
|
} catch (IOException unused) {
|
|
DiskLruCache.access$setMostRecentTrimFailed$p(diskLruCache, true);
|
|
}
|
|
try {
|
|
if (DiskLruCache.access$journalRebuildRequired(diskLruCache)) {
|
|
diskLruCache.rebuildJournal$okhttp();
|
|
DiskLruCache.access$setRedundantOpCount$p(diskLruCache, 0);
|
|
}
|
|
} catch (IOException unused2) {
|
|
DiskLruCache.access$setMostRecentRebuildFailed$p(diskLruCache, true);
|
|
DiskLruCache.access$setJournalWriter$p(diskLruCache, C15160gio.c(C15160gio.c()));
|
|
}
|
|
return -1L;
|
|
}
|
|
}
|
|
};
|
|
if (j <= 0) {
|
|
throw new IllegalArgumentException("maxSize <= 0".toString());
|
|
}
|
|
if (i2 <= 0) {
|
|
throw new IllegalArgumentException("valueCount <= 0".toString());
|
|
}
|
|
this.journalFile = new File(file, JOURNAL_FILE);
|
|
this.journalFileTmp = new File(file, JOURNAL_FILE_TEMP);
|
|
this.journalFileBackup = new File(file, JOURNAL_FILE_BACKUP);
|
|
int i3 = b + 77;
|
|
d = i3 % 128;
|
|
int i4 = i3 % 2;
|
|
}
|
|
|
|
public static final /* synthetic */ boolean access$getCivilizedFileSystem$p(DiskLruCache diskLruCache) {
|
|
int i = 2 % 2;
|
|
int i2 = b + 89;
|
|
int i3 = i2 % 128;
|
|
d = i3;
|
|
int i4 = i2 % 2;
|
|
boolean z = diskLruCache.civilizedFileSystem;
|
|
int i5 = i3 + 3;
|
|
b = i5 % 128;
|
|
int i6 = i5 % 2;
|
|
return z;
|
|
}
|
|
|
|
public static final /* synthetic */ boolean access$getInitialized$p(DiskLruCache diskLruCache) {
|
|
int i = 2 % 2;
|
|
int i2 = d + 85;
|
|
b = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
boolean z = diskLruCache.initialized;
|
|
if (i3 == 0) {
|
|
return z;
|
|
}
|
|
Object obj = null;
|
|
obj.hashCode();
|
|
throw null;
|
|
}
|
|
|
|
public static final /* synthetic */ boolean access$journalRebuildRequired(DiskLruCache diskLruCache) {
|
|
int i = 2 % 2;
|
|
int i2 = d + 63;
|
|
b = i2 % 128;
|
|
if (i2 % 2 == 0) {
|
|
return diskLruCache.journalRebuildRequired();
|
|
}
|
|
diskLruCache.journalRebuildRequired();
|
|
Object obj = null;
|
|
obj.hashCode();
|
|
throw null;
|
|
}
|
|
|
|
public static final /* synthetic */ void access$setHasJournalErrors$p(DiskLruCache diskLruCache, boolean z) {
|
|
int i = 2 % 2;
|
|
int i2 = b;
|
|
int i3 = i2 + 73;
|
|
d = i3 % 128;
|
|
int i4 = i3 % 2;
|
|
diskLruCache.hasJournalErrors = z;
|
|
int i5 = i2 + 51;
|
|
d = i5 % 128;
|
|
if (i5 % 2 == 0) {
|
|
int i6 = 91 / 0;
|
|
}
|
|
}
|
|
|
|
public static final /* synthetic */ void access$setJournalWriter$p(DiskLruCache diskLruCache, InterfaceC15148gic interfaceC15148gic) {
|
|
int i = 2 % 2;
|
|
int i2 = d;
|
|
int i3 = i2 + 1;
|
|
b = i3 % 128;
|
|
int i4 = i3 % 2;
|
|
Object obj = null;
|
|
diskLruCache.journalWriter = interfaceC15148gic;
|
|
if (i4 != 0) {
|
|
obj.hashCode();
|
|
throw null;
|
|
}
|
|
int i5 = i2 + 91;
|
|
b = i5 % 128;
|
|
if (i5 % 2 != 0) {
|
|
throw null;
|
|
}
|
|
}
|
|
|
|
public static final /* synthetic */ void access$setMostRecentRebuildFailed$p(DiskLruCache diskLruCache, boolean z) {
|
|
int i = 2 % 2;
|
|
int i2 = b;
|
|
int i3 = i2 + 1;
|
|
d = i3 % 128;
|
|
int i4 = i3 % 2;
|
|
diskLruCache.mostRecentRebuildFailed = z;
|
|
int i5 = i2 + 117;
|
|
d = i5 % 128;
|
|
int i6 = i5 % 2;
|
|
}
|
|
|
|
public static final /* synthetic */ void access$setMostRecentTrimFailed$p(DiskLruCache diskLruCache, boolean z) {
|
|
int i = 2 % 2;
|
|
int i2 = d + 105;
|
|
int i3 = i2 % 128;
|
|
b = i3;
|
|
int i4 = i2 % 2;
|
|
diskLruCache.mostRecentTrimFailed = z;
|
|
if (i4 != 0) {
|
|
int i5 = 28 / 0;
|
|
}
|
|
int i6 = i3 + 117;
|
|
d = i6 % 128;
|
|
if (i6 % 2 == 0) {
|
|
throw null;
|
|
}
|
|
}
|
|
|
|
public static final /* synthetic */ void access$setRedundantOpCount$p(DiskLruCache diskLruCache, int i) {
|
|
int i2 = 2 % 2;
|
|
int i3 = b + 57;
|
|
int i4 = i3 % 128;
|
|
d = i4;
|
|
int i5 = i3 % 2;
|
|
diskLruCache.redundantOpCount = i;
|
|
int i6 = i4 + 87;
|
|
b = i6 % 128;
|
|
if (i6 % 2 != 0) {
|
|
int i7 = 63 / 0;
|
|
}
|
|
}
|
|
|
|
public final long getMaxSize() {
|
|
long j;
|
|
synchronized (this) {
|
|
j = this.maxSize;
|
|
}
|
|
return j;
|
|
}
|
|
|
|
public final void setMaxSize(long j) {
|
|
synchronized (this) {
|
|
this.maxSize = j;
|
|
if (this.initialized) {
|
|
TaskQueue.schedule$default(this.cleanupQueue, this.cleanupTask, 0L, 2, null);
|
|
}
|
|
}
|
|
}
|
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:31:0x007c, code lost:
|
|
|
|
if (o.C14957gcv.b((java.lang.Object) java.lang.String.valueOf(getValueCount$okhttp()), (java.lang.Object) r7) != false) goto L61;
|
|
*/
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
private final void readJournal() throws java.io.IOException {
|
|
/*
|
|
Method dump skipped, instructions count: 247
|
|
To view this dump add '--comments-level debug' option
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: okhttp3.internal.cache.DiskLruCache.readJournal():void");
|
|
}
|
|
|
|
private final InterfaceC15148gic newJournalWriter() throws FileNotFoundException {
|
|
int i = 2 % 2;
|
|
InterfaceC15148gic c = C15160gio.c(new FaultHidingSink(this.fileSystem.appendingSink(this.journalFile), new DiskLruCache$newJournalWriter$faultHidingSink$1(this)));
|
|
int i2 = d + 109;
|
|
b = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
return c;
|
|
}
|
|
|
|
private final void readJournalLine(String str) throws IOException {
|
|
String substring;
|
|
int i = 2 % 2;
|
|
String str2 = str;
|
|
int a = gdZ.a((CharSequence) str2, ' ', 0, false);
|
|
if (a == -1) {
|
|
throw new IOException(C14957gcv.c("unexpected journal line: ", (Object) str));
|
|
}
|
|
int i2 = a + 1;
|
|
int a2 = gdZ.a((CharSequence) str2, ' ', i2, false);
|
|
if (a2 == -1) {
|
|
substring = str.substring(i2);
|
|
C14957gcv.c((Object) substring, "");
|
|
String str3 = REMOVE;
|
|
if (a == str3.length() && gdZ.e(str, str3, false)) {
|
|
this.lruEntries.remove(substring);
|
|
return;
|
|
}
|
|
} else {
|
|
substring = str.substring(i2, a2);
|
|
C14957gcv.c((Object) substring, "");
|
|
}
|
|
Entry entry = this.lruEntries.get(substring);
|
|
if (entry == null) {
|
|
entry = new Entry(this, substring);
|
|
this.lruEntries.put(substring, entry);
|
|
}
|
|
Object obj = null;
|
|
if (a2 != -1) {
|
|
int i3 = b + 61;
|
|
d = i3 % 128;
|
|
int i4 = i3 % 2;
|
|
String str4 = CLEAN;
|
|
if (a == str4.length() && gdZ.e(str, str4, false)) {
|
|
int i5 = d + 33;
|
|
b = i5 % 128;
|
|
int i6 = i5 % 2;
|
|
String substring2 = str.substring(a2 + 1);
|
|
C14957gcv.c((Object) substring2, "");
|
|
String str5 = substring2;
|
|
char[] cArr = {' '};
|
|
C14957gcv.e(str5, "");
|
|
C14957gcv.e(cArr, "");
|
|
List<String> c = C15017gel.c((CharSequence) str5, String.valueOf(cArr[0]), false, 0);
|
|
entry.setReadable$okhttp(true);
|
|
entry.setCurrentEditor$okhttp(null);
|
|
entry.setLengths$okhttp(c);
|
|
int i7 = b + 51;
|
|
d = i7 % 128;
|
|
if (i7 % 2 == 0) {
|
|
throw null;
|
|
}
|
|
return;
|
|
}
|
|
}
|
|
if (a2 == -1) {
|
|
String str6 = DIRTY;
|
|
if (a == str6.length()) {
|
|
int i8 = b + 25;
|
|
d = i8 % 128;
|
|
int i9 = i8 % 2;
|
|
if (gdZ.e(str, str6, false)) {
|
|
entry.setCurrentEditor$okhttp(new Editor(this, entry));
|
|
int i10 = b + 113;
|
|
d = i10 % 128;
|
|
if (i10 % 2 != 0) {
|
|
return;
|
|
}
|
|
obj.hashCode();
|
|
throw null;
|
|
}
|
|
}
|
|
}
|
|
if (a2 == -1) {
|
|
String str7 = READ;
|
|
if (a == str7.length() && gdZ.e(str, str7, false)) {
|
|
return;
|
|
}
|
|
}
|
|
throw new IOException(C14957gcv.c("unexpected journal line: ", (Object) str));
|
|
}
|
|
|
|
private final void processJournal() throws IOException {
|
|
int i = 2 % 2;
|
|
this.fileSystem.delete(this.journalFileTmp);
|
|
Iterator<Entry> it = this.lruEntries.values().iterator();
|
|
while (it.hasNext()) {
|
|
Entry next = it.next();
|
|
C14957gcv.c(next, "");
|
|
Entry entry = next;
|
|
int i2 = 0;
|
|
if (entry.getCurrentEditor$okhttp() == null) {
|
|
int i3 = b + 75;
|
|
d = i3 % 128;
|
|
if (i3 % 2 == 0) {
|
|
throw null;
|
|
}
|
|
int i4 = this.valueCount;
|
|
while (i2 < i4) {
|
|
this.size += entry.getLengths$okhttp()[i2];
|
|
i2++;
|
|
int i5 = b + 97;
|
|
d = i5 % 128;
|
|
int i6 = i5 % 2;
|
|
}
|
|
} else {
|
|
entry.setCurrentEditor$okhttp(null);
|
|
int i7 = this.valueCount;
|
|
int i8 = b + 121;
|
|
d = i8 % 128;
|
|
if (i8 % 2 == 0) {
|
|
int i9 = 3 % 4;
|
|
}
|
|
while (i2 < i7) {
|
|
this.fileSystem.delete(entry.getCleanFiles$okhttp().get(i2));
|
|
this.fileSystem.delete(entry.getDirtyFiles$okhttp().get(i2));
|
|
i2++;
|
|
}
|
|
it.remove();
|
|
}
|
|
}
|
|
}
|
|
|
|
public final void rebuildJournal$okhttp() throws IOException {
|
|
synchronized (this) {
|
|
InterfaceC15148gic interfaceC15148gic = this.journalWriter;
|
|
if (interfaceC15148gic != null) {
|
|
interfaceC15148gic.close();
|
|
}
|
|
InterfaceC15148gic c = C15160gio.c(this.fileSystem.sink(this.journalFileTmp));
|
|
try {
|
|
InterfaceC15148gic interfaceC15148gic2 = c;
|
|
interfaceC15148gic2.d(MAGIC).b(10);
|
|
interfaceC15148gic2.d(VERSION_1).b(10);
|
|
interfaceC15148gic2.h(this.appVersion).b(10);
|
|
interfaceC15148gic2.h(getValueCount$okhttp()).b(10);
|
|
interfaceC15148gic2.b(10);
|
|
for (Entry entry : getLruEntries$okhttp().values()) {
|
|
if (entry.getCurrentEditor$okhttp() != null) {
|
|
interfaceC15148gic2.d(DIRTY).b(32);
|
|
interfaceC15148gic2.d(entry.getKey$okhttp());
|
|
interfaceC15148gic2.b(10);
|
|
} else {
|
|
interfaceC15148gic2.d(CLEAN).b(32);
|
|
interfaceC15148gic2.d(entry.getKey$okhttp());
|
|
entry.writeLengths$okhttp(interfaceC15148gic2);
|
|
interfaceC15148gic2.b(10);
|
|
}
|
|
}
|
|
C14866gag c14866gag = C14866gag.c;
|
|
gbF.d(c, null);
|
|
if (this.fileSystem.exists(this.journalFile)) {
|
|
this.fileSystem.rename(this.journalFile, this.journalFileBackup);
|
|
}
|
|
this.fileSystem.rename(this.journalFileTmp, this.journalFile);
|
|
this.fileSystem.delete(this.journalFileBackup);
|
|
this.journalWriter = newJournalWriter();
|
|
this.hasJournalErrors = false;
|
|
this.mostRecentRebuildFailed = false;
|
|
} finally {
|
|
}
|
|
}
|
|
}
|
|
|
|
public final Snapshot get(String str) throws IOException {
|
|
synchronized (this) {
|
|
C14957gcv.e(str, "");
|
|
initialize();
|
|
checkNotClosed();
|
|
validateKey(str);
|
|
Entry entry = this.lruEntries.get(str);
|
|
if (entry == null) {
|
|
return null;
|
|
}
|
|
Snapshot snapshot$okhttp = entry.snapshot$okhttp();
|
|
if (snapshot$okhttp == null) {
|
|
return null;
|
|
}
|
|
this.redundantOpCount++;
|
|
InterfaceC15148gic interfaceC15148gic = this.journalWriter;
|
|
C14957gcv.e(interfaceC15148gic);
|
|
interfaceC15148gic.d(READ).b(32).d(str).b(10);
|
|
if (journalRebuildRequired()) {
|
|
TaskQueue.schedule$default(this.cleanupQueue, this.cleanupTask, 0L, 2, null);
|
|
}
|
|
return snapshot$okhttp;
|
|
}
|
|
}
|
|
|
|
public static /* synthetic */ Editor edit$default(DiskLruCache diskLruCache, String str, long j, int i, Object obj) throws IOException {
|
|
int i2 = 2 % 2;
|
|
int i3 = d;
|
|
int i4 = i3 + 47;
|
|
b = i4 % 128;
|
|
int i5 = i4 % 2;
|
|
if ((i & 2) != 0) {
|
|
int i6 = i3 + 107;
|
|
b = i6 % 128;
|
|
int i7 = i6 % 2;
|
|
j = ANY_SEQUENCE_NUMBER;
|
|
}
|
|
Editor edit = diskLruCache.edit(str, j);
|
|
int i8 = b + 99;
|
|
d = i8 % 128;
|
|
int i9 = i8 % 2;
|
|
return edit;
|
|
}
|
|
|
|
public final Editor edit(String str, long j) throws IOException {
|
|
synchronized (this) {
|
|
C14957gcv.e(str, "");
|
|
initialize();
|
|
checkNotClosed();
|
|
validateKey(str);
|
|
Entry entry = this.lruEntries.get(str);
|
|
if (j != ANY_SEQUENCE_NUMBER && (entry == null || entry.getSequenceNumber$okhttp() != j)) {
|
|
return null;
|
|
}
|
|
if ((entry == null ? null : entry.getCurrentEditor$okhttp()) != null) {
|
|
return null;
|
|
}
|
|
if (entry != null && entry.getLockingSourceCount$okhttp() != 0) {
|
|
return null;
|
|
}
|
|
if (!this.mostRecentTrimFailed && !this.mostRecentRebuildFailed) {
|
|
InterfaceC15148gic interfaceC15148gic = this.journalWriter;
|
|
C14957gcv.e(interfaceC15148gic);
|
|
interfaceC15148gic.d(DIRTY).b(32).d(str).b(10);
|
|
interfaceC15148gic.flush();
|
|
if (this.hasJournalErrors) {
|
|
return null;
|
|
}
|
|
if (entry == null) {
|
|
entry = new Entry(this, str);
|
|
this.lruEntries.put(str, entry);
|
|
}
|
|
Editor editor = new Editor(this, entry);
|
|
entry.setCurrentEditor$okhttp(editor);
|
|
return editor;
|
|
}
|
|
TaskQueue.schedule$default(this.cleanupQueue, this.cleanupTask, 0L, 2, null);
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public final long size() throws IOException {
|
|
long j;
|
|
synchronized (this) {
|
|
initialize();
|
|
j = this.size;
|
|
}
|
|
return j;
|
|
}
|
|
|
|
public final void completeEdit$okhttp(Editor editor, boolean z) throws IOException {
|
|
synchronized (this) {
|
|
C14957gcv.e(editor, "");
|
|
Entry entry$okhttp = editor.getEntry$okhttp();
|
|
if (!C14957gcv.b(entry$okhttp.getCurrentEditor$okhttp(), editor)) {
|
|
throw new IllegalStateException("Check failed.".toString());
|
|
}
|
|
if (z && !entry$okhttp.getReadable$okhttp()) {
|
|
int i = this.valueCount;
|
|
for (int i2 = 0; i2 < i; i2++) {
|
|
boolean[] written$okhttp = editor.getWritten$okhttp();
|
|
C14957gcv.e(written$okhttp);
|
|
if (!written$okhttp[i2]) {
|
|
editor.abort();
|
|
throw new IllegalStateException(C14957gcv.c("Newly created entry didn't create value for index ", Integer.valueOf(i2)));
|
|
}
|
|
if (!this.fileSystem.exists(entry$okhttp.getDirtyFiles$okhttp().get(i2))) {
|
|
editor.abort();
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
int i3 = this.valueCount;
|
|
for (int i4 = 0; i4 < i3; i4++) {
|
|
File file = entry$okhttp.getDirtyFiles$okhttp().get(i4);
|
|
if (z && !entry$okhttp.getZombie$okhttp()) {
|
|
if (this.fileSystem.exists(file)) {
|
|
File file2 = entry$okhttp.getCleanFiles$okhttp().get(i4);
|
|
this.fileSystem.rename(file, file2);
|
|
long j = entry$okhttp.getLengths$okhttp()[i4];
|
|
long size = this.fileSystem.size(file2);
|
|
entry$okhttp.getLengths$okhttp()[i4] = size;
|
|
this.size = (this.size - j) + size;
|
|
}
|
|
} else {
|
|
this.fileSystem.delete(file);
|
|
}
|
|
}
|
|
entry$okhttp.setCurrentEditor$okhttp(null);
|
|
if (entry$okhttp.getZombie$okhttp()) {
|
|
removeEntry$okhttp(entry$okhttp);
|
|
return;
|
|
}
|
|
this.redundantOpCount++;
|
|
InterfaceC15148gic interfaceC15148gic = this.journalWriter;
|
|
C14957gcv.e(interfaceC15148gic);
|
|
if (entry$okhttp.getReadable$okhttp() || z) {
|
|
entry$okhttp.setReadable$okhttp(true);
|
|
interfaceC15148gic.d(CLEAN).b(32);
|
|
interfaceC15148gic.d(entry$okhttp.getKey$okhttp());
|
|
entry$okhttp.writeLengths$okhttp(interfaceC15148gic);
|
|
interfaceC15148gic.b(10);
|
|
if (z) {
|
|
long j2 = this.nextSequenceNumber;
|
|
this.nextSequenceNumber = 1 + j2;
|
|
entry$okhttp.setSequenceNumber$okhttp(j2);
|
|
}
|
|
} else {
|
|
getLruEntries$okhttp().remove(entry$okhttp.getKey$okhttp());
|
|
interfaceC15148gic.d(REMOVE).b(32);
|
|
interfaceC15148gic.d(entry$okhttp.getKey$okhttp());
|
|
interfaceC15148gic.b(10);
|
|
}
|
|
interfaceC15148gic.flush();
|
|
if (this.size > this.maxSize || journalRebuildRequired()) {
|
|
TaskQueue.schedule$default(this.cleanupQueue, this.cleanupTask, 0L, 2, null);
|
|
}
|
|
}
|
|
}
|
|
|
|
private final boolean journalRebuildRequired() {
|
|
int i = 2 % 2;
|
|
int i2 = b + 29;
|
|
int i3 = i2 % 128;
|
|
d = i3;
|
|
int i4 = i2 % 2;
|
|
int i5 = this.redundantOpCount;
|
|
if (i5 < 2000) {
|
|
return false;
|
|
}
|
|
int i6 = i3 + 53;
|
|
b = i6 % 128;
|
|
if (i6 % 2 != 0) {
|
|
int i7 = 35 / 0;
|
|
if (i5 < this.lruEntries.size()) {
|
|
return false;
|
|
}
|
|
} else if (i5 < this.lruEntries.size()) {
|
|
return false;
|
|
}
|
|
int i8 = b + 93;
|
|
d = i8 % 128;
|
|
int i9 = i8 % 2;
|
|
return true;
|
|
}
|
|
|
|
public final boolean remove(String str) throws IOException {
|
|
synchronized (this) {
|
|
C14957gcv.e(str, "");
|
|
initialize();
|
|
checkNotClosed();
|
|
validateKey(str);
|
|
Entry entry = this.lruEntries.get(str);
|
|
if (entry == null) {
|
|
return false;
|
|
}
|
|
boolean removeEntry$okhttp = removeEntry$okhttp(entry);
|
|
if (removeEntry$okhttp && this.size <= this.maxSize) {
|
|
this.mostRecentTrimFailed = false;
|
|
}
|
|
return removeEntry$okhttp;
|
|
}
|
|
}
|
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:15:0x006a, code lost:
|
|
|
|
if (r12.getCurrentEditor$okhttp() != null) goto L50;
|
|
*/
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
public final boolean removeEntry$okhttp(okhttp3.internal.cache.DiskLruCache.Entry r12) throws java.io.IOException {
|
|
/*
|
|
r11 = this;
|
|
r0 = 2
|
|
int r1 = r0 % r0
|
|
java.lang.String r1 = ""
|
|
o.C14957gcv.e(r12, r1)
|
|
boolean r1 = r11.civilizedFileSystem
|
|
r2 = 32
|
|
r3 = 10
|
|
r4 = 1
|
|
if (r1 == r4) goto L79
|
|
int r1 = r12.getLockingSourceCount$okhttp()
|
|
if (r1 <= 0) goto L57
|
|
int r1 = okhttp3.internal.cache.DiskLruCache.b
|
|
int r5 = r1 + 33
|
|
int r6 = r5 % 128
|
|
okhttp3.internal.cache.DiskLruCache.d = r6
|
|
int r5 = r5 % r0
|
|
o.gic r5 = r11.journalWriter
|
|
if (r5 == 0) goto L57
|
|
int r1 = r1 + 97
|
|
int r6 = r1 % 128
|
|
okhttp3.internal.cache.DiskLruCache.d = r6
|
|
int r1 = r1 % r0
|
|
if (r1 != 0) goto L42
|
|
java.lang.String r1 = okhttp3.internal.cache.DiskLruCache.DIRTY
|
|
r5.d(r1)
|
|
r5.b(r3)
|
|
java.lang.String r1 = r12.getKey$okhttp()
|
|
r5.d(r1)
|
|
r1 = 74
|
|
r5.b(r1)
|
|
goto L54
|
|
L42:
|
|
java.lang.String r1 = okhttp3.internal.cache.DiskLruCache.DIRTY
|
|
r5.d(r1)
|
|
r5.b(r2)
|
|
java.lang.String r1 = r12.getKey$okhttp()
|
|
r5.d(r1)
|
|
r5.b(r3)
|
|
L54:
|
|
r5.flush()
|
|
L57:
|
|
int r1 = r12.getLockingSourceCount$okhttp()
|
|
if (r1 > 0) goto L6c
|
|
int r1 = okhttp3.internal.cache.DiskLruCache.d
|
|
int r1 = r1 + 107
|
|
int r5 = r1 % 128
|
|
okhttp3.internal.cache.DiskLruCache.b = r5
|
|
int r1 = r1 % r0
|
|
okhttp3.internal.cache.DiskLruCache$Editor r1 = r12.getCurrentEditor$okhttp()
|
|
if (r1 == 0) goto L79
|
|
L6c:
|
|
r12.setZombie$okhttp(r4)
|
|
int r12 = okhttp3.internal.cache.DiskLruCache.d
|
|
int r12 = r12 + 111
|
|
int r1 = r12 % 128
|
|
okhttp3.internal.cache.DiskLruCache.b = r1
|
|
int r12 = r12 % r0
|
|
return r4
|
|
L79:
|
|
okhttp3.internal.cache.DiskLruCache$Editor r0 = r12.getCurrentEditor$okhttp()
|
|
if (r0 == 0) goto L82
|
|
r0.detach$okhttp()
|
|
L82:
|
|
int r0 = r11.valueCount
|
|
r1 = 0
|
|
L85:
|
|
if (r1 >= r0) goto Lac
|
|
okhttp3.internal.io.FileSystem r5 = r11.fileSystem
|
|
java.util.List r6 = r12.getCleanFiles$okhttp()
|
|
java.lang.Object r6 = r6.get(r1)
|
|
java.io.File r6 = (java.io.File) r6
|
|
r5.delete(r6)
|
|
long r5 = r11.size
|
|
long[] r7 = r12.getLengths$okhttp()
|
|
r8 = r7[r1]
|
|
long r5 = r5 - r8
|
|
r11.size = r5
|
|
long[] r5 = r12.getLengths$okhttp()
|
|
r6 = 0
|
|
r5[r1] = r6
|
|
int r1 = r1 + 1
|
|
goto L85
|
|
Lac:
|
|
int r0 = r11.redundantOpCount
|
|
int r0 = r0 + r4
|
|
r11.redundantOpCount = r0
|
|
o.gic r0 = r11.journalWriter
|
|
if (r0 == 0) goto Lc7
|
|
java.lang.String r1 = okhttp3.internal.cache.DiskLruCache.REMOVE
|
|
r0.d(r1)
|
|
r0.b(r2)
|
|
java.lang.String r1 = r12.getKey$okhttp()
|
|
r0.d(r1)
|
|
r0.b(r3)
|
|
Lc7:
|
|
java.util.LinkedHashMap<java.lang.String, okhttp3.internal.cache.DiskLruCache$Entry> r0 = r11.lruEntries
|
|
java.lang.String r12 = r12.getKey$okhttp()
|
|
r0.remove(r12)
|
|
boolean r12 = r11.journalRebuildRequired()
|
|
if (r12 == 0) goto Le4
|
|
okhttp3.internal.concurrent.TaskQueue r5 = r11.cleanupQueue
|
|
okhttp3.internal.cache.DiskLruCache$cleanupTask$1 r12 = r11.cleanupTask
|
|
r6 = r12
|
|
okhttp3.internal.concurrent.Task r6 = (okhttp3.internal.concurrent.Task) r6
|
|
r7 = 0
|
|
r9 = 2
|
|
r10 = 0
|
|
okhttp3.internal.concurrent.TaskQueue.schedule$default(r5, r6, r7, r9, r10)
|
|
Le4:
|
|
return r4
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: okhttp3.internal.cache.DiskLruCache.removeEntry$okhttp(okhttp3.internal.cache.DiskLruCache$Entry):boolean");
|
|
}
|
|
|
|
private final void checkNotClosed() {
|
|
synchronized (this) {
|
|
if (!(!this.closed)) {
|
|
throw new IllegalStateException("cache is closed".toString());
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // java.io.Flushable
|
|
public final void flush() throws IOException {
|
|
synchronized (this) {
|
|
if (this.initialized) {
|
|
checkNotClosed();
|
|
trimToSize();
|
|
InterfaceC15148gic interfaceC15148gic = this.journalWriter;
|
|
C14957gcv.e(interfaceC15148gic);
|
|
interfaceC15148gic.flush();
|
|
}
|
|
}
|
|
}
|
|
|
|
public final boolean isClosed() {
|
|
boolean z;
|
|
synchronized (this) {
|
|
z = this.closed;
|
|
}
|
|
return z;
|
|
}
|
|
|
|
@Override // java.io.Closeable, java.lang.AutoCloseable
|
|
public final void close() throws IOException {
|
|
Editor currentEditor$okhttp;
|
|
synchronized (this) {
|
|
if (this.initialized && !this.closed) {
|
|
Collection<Entry> values = this.lruEntries.values();
|
|
C14957gcv.c(values, "");
|
|
int i = 0;
|
|
Object[] array = values.toArray(new Entry[0]);
|
|
if (array != null) {
|
|
Entry[] entryArr = (Entry[]) array;
|
|
int length = entryArr.length;
|
|
while (i < length) {
|
|
Entry entry = entryArr[i];
|
|
i++;
|
|
if (entry.getCurrentEditor$okhttp() != null && (currentEditor$okhttp = entry.getCurrentEditor$okhttp()) != null) {
|
|
currentEditor$okhttp.detach$okhttp();
|
|
}
|
|
}
|
|
trimToSize();
|
|
InterfaceC15148gic interfaceC15148gic = this.journalWriter;
|
|
C14957gcv.e(interfaceC15148gic);
|
|
interfaceC15148gic.close();
|
|
this.journalWriter = null;
|
|
this.closed = true;
|
|
return;
|
|
}
|
|
throw new NullPointerException("null cannot be cast to non-null type kotlin.Array<T of kotlin.collections.ArraysKt__ArraysJVMKt.toTypedArray>");
|
|
}
|
|
this.closed = true;
|
|
}
|
|
}
|
|
|
|
public final void trimToSize() throws IOException {
|
|
int i = 2 % 2;
|
|
while (this.size > this.maxSize) {
|
|
int i2 = d + 19;
|
|
b = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
if (!removeOldestEntry()) {
|
|
int i4 = d + 89;
|
|
b = i4 % 128;
|
|
if (i4 % 2 == 0) {
|
|
return;
|
|
}
|
|
Object obj = null;
|
|
obj.hashCode();
|
|
throw null;
|
|
}
|
|
}
|
|
this.mostRecentTrimFailed = false;
|
|
}
|
|
|
|
private final boolean removeOldestEntry() {
|
|
int i = 2 % 2;
|
|
int i2 = b + 53;
|
|
d = i2 % 128;
|
|
if (i2 % 2 == 0) {
|
|
this.lruEntries.values().iterator();
|
|
throw null;
|
|
}
|
|
for (Entry entry : this.lruEntries.values()) {
|
|
int i3 = d + 25;
|
|
b = i3 % 128;
|
|
int i4 = i3 % 2;
|
|
if (!entry.getZombie$okhttp()) {
|
|
int i5 = b + 103;
|
|
d = i5 % 128;
|
|
if (i5 % 2 == 0) {
|
|
C14957gcv.c(entry, "");
|
|
removeEntry$okhttp(entry);
|
|
return true;
|
|
}
|
|
C14957gcv.c(entry, "");
|
|
removeEntry$okhttp(entry);
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public final void delete() throws IOException {
|
|
int i = 2 % 2;
|
|
int i2 = d + 13;
|
|
b = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
close();
|
|
this.fileSystem.deleteContents(this.directory);
|
|
int i4 = b + 95;
|
|
d = i4 % 128;
|
|
int i5 = i4 % 2;
|
|
}
|
|
|
|
public final void evictAll() throws IOException {
|
|
synchronized (this) {
|
|
initialize();
|
|
Collection<Entry> values = this.lruEntries.values();
|
|
C14957gcv.c(values, "");
|
|
Object[] array = values.toArray(new Entry[0]);
|
|
if (array != null) {
|
|
Entry[] entryArr = (Entry[]) array;
|
|
int length = entryArr.length;
|
|
int i = 0;
|
|
while (i < length) {
|
|
Entry entry = entryArr[i];
|
|
i++;
|
|
C14957gcv.c(entry, "");
|
|
removeEntry$okhttp(entry);
|
|
}
|
|
this.mostRecentTrimFailed = false;
|
|
} else {
|
|
throw new NullPointerException("null cannot be cast to non-null type kotlin.Array<T of kotlin.collections.ArraysKt__ArraysJVMKt.toTypedArray>");
|
|
}
|
|
}
|
|
}
|
|
|
|
private final void validateKey(String str) {
|
|
int i = 2 % 2;
|
|
int i2 = d + 49;
|
|
b = i2 % 128;
|
|
Object obj = null;
|
|
if (i2 % 2 != 0) {
|
|
gdW gdw = LEGAL_KEY_PATTERN;
|
|
String str2 = str;
|
|
C14957gcv.e(str2, "");
|
|
gdw.e.matcher(str2).matches();
|
|
obj.hashCode();
|
|
throw null;
|
|
}
|
|
gdW gdw2 = LEGAL_KEY_PATTERN;
|
|
String str3 = str;
|
|
C14957gcv.e(str3, "");
|
|
if (!gdw2.e.matcher(str3).matches()) {
|
|
StringBuilder sb = new StringBuilder("keys must match regex [a-z0-9_-]{1,120}: \"");
|
|
sb.append(str);
|
|
sb.append('\"');
|
|
throw new IllegalArgumentException(sb.toString().toString());
|
|
}
|
|
int i3 = b + 25;
|
|
d = i3 % 128;
|
|
if (i3 % 2 != 0) {
|
|
return;
|
|
}
|
|
obj.hashCode();
|
|
throw null;
|
|
}
|
|
|
|
public final Iterator<Snapshot> snapshots() throws IOException {
|
|
DiskLruCache$snapshots$1 diskLruCache$snapshots$1;
|
|
synchronized (this) {
|
|
initialize();
|
|
diskLruCache$snapshots$1 = new DiskLruCache$snapshots$1(this);
|
|
}
|
|
return diskLruCache$snapshots$1;
|
|
}
|
|
|
|
/* loaded from: classes.dex */
|
|
public final class Snapshot implements Closeable {
|
|
private final String key;
|
|
private final long[] lengths;
|
|
private final long sequenceNumber;
|
|
private final List<giD> sources;
|
|
final DiskLruCache this$0;
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public Snapshot(DiskLruCache diskLruCache, String str, long j, List<? extends giD> list, long[] jArr) {
|
|
C14957gcv.e(diskLruCache, "");
|
|
C14957gcv.e(str, "");
|
|
C14957gcv.e(list, "");
|
|
C14957gcv.e(jArr, "");
|
|
this.this$0 = diskLruCache;
|
|
this.key = str;
|
|
this.sequenceNumber = j;
|
|
this.sources = list;
|
|
this.lengths = jArr;
|
|
}
|
|
|
|
public final Editor edit() throws IOException {
|
|
return this.this$0.edit(this.key, this.sequenceNumber);
|
|
}
|
|
|
|
public final giD getSource(int i) {
|
|
return this.sources.get(i);
|
|
}
|
|
|
|
public final long getLength(int i) {
|
|
return this.lengths[i];
|
|
}
|
|
|
|
@Override // java.io.Closeable, java.lang.AutoCloseable
|
|
public final void close() {
|
|
Iterator<giD> it = this.sources.iterator();
|
|
while (it.hasNext()) {
|
|
Util.closeQuietly(it.next());
|
|
}
|
|
}
|
|
|
|
public final String key() {
|
|
return this.key;
|
|
}
|
|
}
|
|
|
|
/* loaded from: classes.dex */
|
|
public final class Editor {
|
|
private boolean done;
|
|
private final Entry entry;
|
|
final DiskLruCache this$0;
|
|
private final boolean[] written;
|
|
|
|
public Editor(DiskLruCache diskLruCache, Entry entry) {
|
|
C14957gcv.e(diskLruCache, "");
|
|
C14957gcv.e(entry, "");
|
|
this.this$0 = diskLruCache;
|
|
this.entry = entry;
|
|
this.written = entry.getReadable$okhttp() ? null : new boolean[diskLruCache.getValueCount$okhttp()];
|
|
}
|
|
|
|
public final void detach$okhttp() {
|
|
if (C14957gcv.b(this.entry.getCurrentEditor$okhttp(), this)) {
|
|
if (DiskLruCache.access$getCivilizedFileSystem$p(this.this$0)) {
|
|
this.this$0.completeEdit$okhttp(this, false);
|
|
} else {
|
|
this.entry.setZombie$okhttp(true);
|
|
}
|
|
}
|
|
}
|
|
|
|
public final giD newSource(int i) {
|
|
DiskLruCache diskLruCache = this.this$0;
|
|
synchronized (diskLruCache) {
|
|
if (!(!this.done)) {
|
|
throw new IllegalStateException("Check failed.".toString());
|
|
}
|
|
giD gid = null;
|
|
if (!getEntry$okhttp().getReadable$okhttp() || !C14957gcv.b(getEntry$okhttp().getCurrentEditor$okhttp(), this) || getEntry$okhttp().getZombie$okhttp()) {
|
|
return null;
|
|
}
|
|
try {
|
|
gid = diskLruCache.getFileSystem$okhttp().source(getEntry$okhttp().getCleanFiles$okhttp().get(i));
|
|
} catch (FileNotFoundException unused) {
|
|
}
|
|
return gid;
|
|
}
|
|
}
|
|
|
|
public final InterfaceC15168giw newSink(int i) {
|
|
DiskLruCache diskLruCache = this.this$0;
|
|
synchronized (diskLruCache) {
|
|
if (!(!this.done)) {
|
|
throw new IllegalStateException("Check failed.".toString());
|
|
}
|
|
if (!C14957gcv.b(getEntry$okhttp().getCurrentEditor$okhttp(), this)) {
|
|
return C15160gio.c();
|
|
}
|
|
if (!getEntry$okhttp().getReadable$okhttp()) {
|
|
boolean[] written$okhttp = getWritten$okhttp();
|
|
C14957gcv.e(written$okhttp);
|
|
written$okhttp[i] = true;
|
|
}
|
|
try {
|
|
return new FaultHidingSink(diskLruCache.getFileSystem$okhttp().sink(getEntry$okhttp().getDirtyFiles$okhttp().get(i)), new DiskLruCache$Editor$newSink$1$1(diskLruCache, this));
|
|
} catch (FileNotFoundException unused) {
|
|
return C15160gio.c();
|
|
}
|
|
}
|
|
}
|
|
|
|
public final void commit() throws IOException {
|
|
DiskLruCache diskLruCache = this.this$0;
|
|
synchronized (diskLruCache) {
|
|
if (!(!this.done)) {
|
|
throw new IllegalStateException("Check failed.".toString());
|
|
}
|
|
if (C14957gcv.b(getEntry$okhttp().getCurrentEditor$okhttp(), this)) {
|
|
diskLruCache.completeEdit$okhttp(this, true);
|
|
}
|
|
this.done = true;
|
|
C14866gag c14866gag = C14866gag.c;
|
|
}
|
|
}
|
|
|
|
public final void abort() throws IOException {
|
|
DiskLruCache diskLruCache = this.this$0;
|
|
synchronized (diskLruCache) {
|
|
if (!(!this.done)) {
|
|
throw new IllegalStateException("Check failed.".toString());
|
|
}
|
|
if (C14957gcv.b(getEntry$okhttp().getCurrentEditor$okhttp(), this)) {
|
|
diskLruCache.completeEdit$okhttp(this, false);
|
|
}
|
|
this.done = true;
|
|
C14866gag c14866gag = C14866gag.c;
|
|
}
|
|
}
|
|
|
|
public final boolean[] getWritten$okhttp() {
|
|
return this.written;
|
|
}
|
|
|
|
public final Entry getEntry$okhttp() {
|
|
return this.entry;
|
|
}
|
|
}
|
|
|
|
/* loaded from: classes.dex */
|
|
public final class Entry {
|
|
private final List<File> cleanFiles;
|
|
private Editor currentEditor;
|
|
private final List<File> dirtyFiles;
|
|
private final String key;
|
|
private final long[] lengths;
|
|
private int lockingSourceCount;
|
|
private boolean readable;
|
|
private long sequenceNumber;
|
|
final DiskLruCache this$0;
|
|
private boolean zombie;
|
|
|
|
public Entry(DiskLruCache diskLruCache, String str) {
|
|
C14957gcv.e(diskLruCache, "");
|
|
C14957gcv.e(str, "");
|
|
this.this$0 = diskLruCache;
|
|
this.key = str;
|
|
this.lengths = new long[diskLruCache.getValueCount$okhttp()];
|
|
this.cleanFiles = new ArrayList();
|
|
this.dirtyFiles = new ArrayList();
|
|
StringBuilder sb = new StringBuilder(str);
|
|
sb.append('.');
|
|
int length = sb.length();
|
|
int valueCount$okhttp = diskLruCache.getValueCount$okhttp();
|
|
for (int i = 0; i < valueCount$okhttp; i++) {
|
|
sb.append(i);
|
|
this.cleanFiles.add(new File(this.this$0.getDirectory(), sb.toString()));
|
|
sb.append(".tmp");
|
|
this.dirtyFiles.add(new File(this.this$0.getDirectory(), sb.toString()));
|
|
sb.setLength(length);
|
|
}
|
|
}
|
|
|
|
public final void setLengths$okhttp(List<String> list) throws IOException {
|
|
C14957gcv.e(list, "");
|
|
if (list.size() != this.this$0.getValueCount$okhttp()) {
|
|
invalidLengths(list);
|
|
throw new KotlinNothingValueException();
|
|
}
|
|
try {
|
|
int size = list.size();
|
|
for (int i = 0; i < size; i++) {
|
|
this.lengths[i] = Long.parseLong(list.get(i));
|
|
}
|
|
} catch (NumberFormatException unused) {
|
|
invalidLengths(list);
|
|
throw new KotlinNothingValueException();
|
|
}
|
|
}
|
|
|
|
public final void writeLengths$okhttp(InterfaceC15148gic interfaceC15148gic) throws IOException {
|
|
C14957gcv.e(interfaceC15148gic, "");
|
|
long[] jArr = this.lengths;
|
|
int length = jArr.length;
|
|
int i = 0;
|
|
while (i < length) {
|
|
long j = jArr[i];
|
|
i++;
|
|
interfaceC15148gic.b(32).h(j);
|
|
}
|
|
}
|
|
|
|
private final Void invalidLengths(List<String> list) throws IOException {
|
|
throw new IOException(C14957gcv.c("unexpected journal line: ", list));
|
|
}
|
|
|
|
private final giD newSource(int i) {
|
|
giD source = this.this$0.getFileSystem$okhttp().source(this.cleanFiles.get(i));
|
|
if (DiskLruCache.access$getCivilizedFileSystem$p(this.this$0)) {
|
|
return source;
|
|
}
|
|
this.lockingSourceCount++;
|
|
return new AbstractC15154gii(source, this.this$0, this) { // from class: okhttp3.internal.cache.DiskLruCache$Entry$newSource$1
|
|
final giD $fileSource;
|
|
private boolean closed;
|
|
final DiskLruCache this$0;
|
|
final DiskLruCache.Entry this$1;
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
|
{
|
|
super(source);
|
|
this.$fileSource = source;
|
|
this.this$0 = r2;
|
|
this.this$1 = this;
|
|
}
|
|
|
|
@Override // o.AbstractC15154gii, o.giD, java.io.Closeable, java.lang.AutoCloseable
|
|
public final void close() {
|
|
super.close();
|
|
if (this.closed) {
|
|
return;
|
|
}
|
|
this.closed = true;
|
|
DiskLruCache diskLruCache = this.this$0;
|
|
DiskLruCache.Entry entry = this.this$1;
|
|
synchronized (diskLruCache) {
|
|
entry.setLockingSourceCount$okhttp(entry.getLockingSourceCount$okhttp() - 1);
|
|
if (entry.getLockingSourceCount$okhttp() == 0 && entry.getZombie$okhttp()) {
|
|
diskLruCache.removeEntry$okhttp(entry);
|
|
}
|
|
C14866gag c14866gag = C14866gag.c;
|
|
}
|
|
}
|
|
};
|
|
}
|
|
|
|
public final Snapshot snapshot$okhttp() {
|
|
DiskLruCache diskLruCache = this.this$0;
|
|
if (Util.assertionsEnabled && !Thread.holdsLock(diskLruCache)) {
|
|
StringBuilder sb = new StringBuilder("Thread ");
|
|
sb.append((Object) Thread.currentThread().getName());
|
|
sb.append(" MUST hold lock on ");
|
|
sb.append(diskLruCache);
|
|
throw new AssertionError(sb.toString());
|
|
}
|
|
if (!this.readable) {
|
|
return null;
|
|
}
|
|
if (!DiskLruCache.access$getCivilizedFileSystem$p(this.this$0) && (this.currentEditor != null || this.zombie)) {
|
|
return null;
|
|
}
|
|
ArrayList arrayList = new ArrayList();
|
|
long[] jArr = (long[]) this.lengths.clone();
|
|
try {
|
|
int valueCount$okhttp = this.this$0.getValueCount$okhttp();
|
|
for (int i = 0; i < valueCount$okhttp; i++) {
|
|
arrayList.add(newSource(i));
|
|
}
|
|
return new Snapshot(this.this$0, this.key, this.sequenceNumber, arrayList, jArr);
|
|
} catch (FileNotFoundException unused) {
|
|
Iterator it = arrayList.iterator();
|
|
while (it.hasNext()) {
|
|
Util.closeQuietly((giD) it.next());
|
|
}
|
|
try {
|
|
this.this$0.removeEntry$okhttp(this);
|
|
} catch (IOException unused2) {
|
|
}
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public final void setZombie$okhttp(boolean z) {
|
|
this.zombie = z;
|
|
}
|
|
|
|
public final void setSequenceNumber$okhttp(long j) {
|
|
this.sequenceNumber = j;
|
|
}
|
|
|
|
public final void setReadable$okhttp(boolean z) {
|
|
this.readable = z;
|
|
}
|
|
|
|
public final void setLockingSourceCount$okhttp(int i) {
|
|
this.lockingSourceCount = i;
|
|
}
|
|
|
|
public final void setCurrentEditor$okhttp(Editor editor) {
|
|
this.currentEditor = editor;
|
|
}
|
|
|
|
public final boolean getZombie$okhttp() {
|
|
return this.zombie;
|
|
}
|
|
|
|
public final long getSequenceNumber$okhttp() {
|
|
return this.sequenceNumber;
|
|
}
|
|
|
|
public final boolean getReadable$okhttp() {
|
|
return this.readable;
|
|
}
|
|
|
|
public final int getLockingSourceCount$okhttp() {
|
|
return this.lockingSourceCount;
|
|
}
|
|
|
|
public final long[] getLengths$okhttp() {
|
|
return this.lengths;
|
|
}
|
|
|
|
public final String getKey$okhttp() {
|
|
return this.key;
|
|
}
|
|
|
|
public final List<File> getDirtyFiles$okhttp() {
|
|
return this.dirtyFiles;
|
|
}
|
|
|
|
public final Editor getCurrentEditor$okhttp() {
|
|
return this.currentEditor;
|
|
}
|
|
|
|
public final List<File> getCleanFiles$okhttp() {
|
|
return this.cleanFiles;
|
|
}
|
|
}
|
|
|
|
/* loaded from: classes.dex */
|
|
public static final class Companion {
|
|
private Companion() {
|
|
}
|
|
|
|
public /* synthetic */ Companion(C14953gcr c14953gcr) {
|
|
this();
|
|
}
|
|
}
|
|
|
|
static {
|
|
b = 0;
|
|
e();
|
|
Companion = new Companion(null);
|
|
JOURNAL_FILE = "journal";
|
|
JOURNAL_FILE_TEMP = "journal.tmp";
|
|
JOURNAL_FILE_BACKUP = "journal.bkp";
|
|
MAGIC = "libcore.io.DiskLruCache";
|
|
Object[] objArr = new Object[1];
|
|
c(new char[]{48124}, 10513 - (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)), objArr);
|
|
VERSION_1 = ((String) objArr[0]).intern();
|
|
ANY_SEQUENCE_NUMBER = -1L;
|
|
LEGAL_KEY_PATTERN = new gdW("[a-z0-9_-]{1,120}");
|
|
CLEAN = "CLEAN";
|
|
DIRTY = "DIRTY";
|
|
REMOVE = "REMOVE";
|
|
READ = "READ";
|
|
int i = d + 103;
|
|
b = i % 128;
|
|
if (i % 2 != 0) {
|
|
int i2 = 77 / 0;
|
|
}
|
|
}
|
|
|
|
public final void initialize() throws IOException {
|
|
synchronized (this) {
|
|
if (Util.assertionsEnabled && !Thread.holdsLock(this)) {
|
|
StringBuilder sb = new StringBuilder("Thread ");
|
|
sb.append((Object) Thread.currentThread().getName());
|
|
sb.append(" MUST hold lock on ");
|
|
sb.append(this);
|
|
throw new AssertionError(sb.toString());
|
|
}
|
|
if (this.initialized) {
|
|
return;
|
|
}
|
|
if (this.fileSystem.exists(this.journalFileBackup)) {
|
|
if (this.fileSystem.exists(this.journalFile)) {
|
|
this.fileSystem.delete(this.journalFileBackup);
|
|
} else {
|
|
this.fileSystem.rename(this.journalFileBackup, this.journalFile);
|
|
}
|
|
}
|
|
this.civilizedFileSystem = Util.isCivilized(this.fileSystem, this.journalFileBackup);
|
|
if (this.fileSystem.exists(this.journalFile)) {
|
|
try {
|
|
readJournal();
|
|
processJournal();
|
|
this.initialized = true;
|
|
return;
|
|
} catch (IOException e2) {
|
|
Platform platform = Platform.Companion.get();
|
|
StringBuilder sb2 = new StringBuilder("DiskLruCache ");
|
|
sb2.append(this.directory);
|
|
sb2.append(" is corrupt: ");
|
|
sb2.append((Object) e2.getMessage());
|
|
sb2.append(", removing");
|
|
platform.log(sb2.toString(), 5, e2);
|
|
try {
|
|
delete();
|
|
this.closed = false;
|
|
} catch (Throwable th) {
|
|
this.closed = false;
|
|
throw th;
|
|
}
|
|
}
|
|
}
|
|
rebuildJournal$okhttp();
|
|
this.initialized = true;
|
|
}
|
|
}
|
|
|
|
static void e() {
|
|
e = 4630516139205699595L;
|
|
}
|
|
|
|
public final void setClosed$okhttp(boolean z) {
|
|
int i = 2 % 2;
|
|
int i2 = d + 89;
|
|
b = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
this.closed = z;
|
|
if (i3 != 0) {
|
|
throw null;
|
|
}
|
|
}
|
|
|
|
public final int getValueCount$okhttp() {
|
|
int i = 2 % 2;
|
|
int i2 = b;
|
|
int i3 = i2 + 115;
|
|
d = i3 % 128;
|
|
int i4 = i3 % 2;
|
|
int i5 = this.valueCount;
|
|
int i6 = i2 + 31;
|
|
d = i6 % 128;
|
|
if (i6 % 2 != 0) {
|
|
return i5;
|
|
}
|
|
Object obj = null;
|
|
obj.hashCode();
|
|
throw null;
|
|
}
|
|
|
|
public final LinkedHashMap<String, Entry> getLruEntries$okhttp() {
|
|
int i = 2 % 2;
|
|
int i2 = b + 55;
|
|
int i3 = i2 % 128;
|
|
d = i3;
|
|
int i4 = i2 % 2;
|
|
LinkedHashMap<String, Entry> linkedHashMap = this.lruEntries;
|
|
int i5 = i3 + 25;
|
|
b = i5 % 128;
|
|
if (i5 % 2 != 0) {
|
|
int i6 = 85 / 0;
|
|
}
|
|
return linkedHashMap;
|
|
}
|
|
|
|
public final FileSystem getFileSystem$okhttp() {
|
|
int i = 2 % 2;
|
|
int i2 = d;
|
|
int i3 = i2 + 3;
|
|
b = i3 % 128;
|
|
int i4 = i3 % 2;
|
|
FileSystem fileSystem = this.fileSystem;
|
|
int i5 = i2 + 17;
|
|
b = i5 % 128;
|
|
int i6 = i5 % 2;
|
|
return fileSystem;
|
|
}
|
|
|
|
public final File getDirectory() {
|
|
int i = 2 % 2;
|
|
int i2 = b;
|
|
int i3 = i2 + 53;
|
|
d = i3 % 128;
|
|
int i4 = i3 % 2;
|
|
File file = this.directory;
|
|
int i5 = i2 + 77;
|
|
d = i5 % 128;
|
|
int i6 = i5 % 2;
|
|
return file;
|
|
}
|
|
|
|
public final boolean getClosed$okhttp() {
|
|
int i = 2 % 2;
|
|
int i2 = b + 1;
|
|
int i3 = i2 % 128;
|
|
d = i3;
|
|
int i4 = i2 % 2;
|
|
boolean z = this.closed;
|
|
int i5 = i3 + 105;
|
|
b = i5 % 128;
|
|
int i6 = i5 % 2;
|
|
return z;
|
|
}
|
|
|
|
public final Editor edit(String str) throws IOException {
|
|
int i = 2 % 2;
|
|
int i2 = d + 111;
|
|
b = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
C14957gcv.e(str, "");
|
|
Editor edit$default = edit$default(this, str, 0L, 2, null);
|
|
int i4 = b + 63;
|
|
d = i4 % 128;
|
|
int i5 = i4 % 2;
|
|
return edit$default;
|
|
}
|
|
}
|