Rabbit-R1/original r1/java/sources/okhttp3/CacheControl.java
2024-05-21 17:08:36 -04:00

347 lines
18 KiB
Java

package okhttp3;
import io.flutter.plugin.editing.SpellCheckPlugin;
import io.sentry.protocol.OperatingSystem;
import java.util.concurrent.TimeUnit;
import kotlin.Deprecated;
import kotlin.DeprecationLevel;
import kotlin.Metadata;
import kotlin.ReplaceWith;
import kotlin.jvm.JvmStatic;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt;
/* compiled from: CacheControl.kt */
@Metadata(bv = {1, 0, 3}, d1 = {"\u0000\"\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\n\n\u0002\u0010\u000e\n\u0002\b\u0011\u0018\u0000 !2\u00020\u0001:\u0002 !Bq\b\u0002\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0003\u0012\u0006\u0010\u0005\u001a\u00020\u0006\u0012\u0006\u0010\u0007\u001a\u00020\u0006\u0012\u0006\u0010\b\u001a\u00020\u0003\u0012\u0006\u0010\t\u001a\u00020\u0003\u0012\u0006\u0010\n\u001a\u00020\u0003\u0012\u0006\u0010\u000b\u001a\u00020\u0006\u0012\u0006\u0010\f\u001a\u00020\u0006\u0012\u0006\u0010\r\u001a\u00020\u0003\u0012\u0006\u0010\u000e\u001a\u00020\u0003\u0012\u0006\u0010\u000f\u001a\u00020\u0003\u0012\b\u0010\u0010\u001a\u0004\u0018\u00010\u0011¢\u0006\u0002\u0010\u0012J\r\u0010\u000f\u001a\u00020\u0003H\u0007¢\u0006\u0002\b\u0015J\r\u0010\u0005\u001a\u00020\u0006H\u0007¢\u0006\u0002\b\u0016J\r\u0010\u000b\u001a\u00020\u0006H\u0007¢\u0006\u0002\b\u0017J\r\u0010\f\u001a\u00020\u0006H\u0007¢\u0006\u0002\b\u0018J\r\u0010\n\u001a\u00020\u0003H\u0007¢\u0006\u0002\b\u0019J\r\u0010\u0002\u001a\u00020\u0003H\u0007¢\u0006\u0002\b\u001aJ\r\u0010\u0004\u001a\u00020\u0003H\u0007¢\u0006\u0002\b\u001bJ\r\u0010\u000e\u001a\u00020\u0003H\u0007¢\u0006\u0002\b\u001cJ\r\u0010\r\u001a\u00020\u0003H\u0007¢\u0006\u0002\b\u001dJ\r\u0010\u0007\u001a\u00020\u0006H\u0007¢\u0006\u0002\b\u001eJ\b\u0010\u001f\u001a\u00020\u0011H\u0016R\u0010\u0010\u0010\u001a\u0004\u0018\u00010\u0011X\u0082\u000e¢\u0006\u0002\n\u0000R\u0013\u0010\u000f\u001a\u00020\u00038\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u000f\u0010\u0013R\u0011\u0010\b\u001a\u00020\u0003¢\u0006\b\n\u0000\u001a\u0004\b\b\u0010\u0013R\u0011\u0010\t\u001a\u00020\u0003¢\u0006\b\n\u0000\u001a\u0004\b\t\u0010\u0013R\u0013\u0010\u0005\u001a\u00020\u00068\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u0005\u0010\u0014R\u0013\u0010\u000b\u001a\u00020\u00068\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u000b\u0010\u0014R\u0013\u0010\f\u001a\u00020\u00068\u0007¢\u0006\b\n\u0000\u001a\u0004\b\f\u0010\u0014R\u0013\u0010\n\u001a\u00020\u00038\u0007¢\u0006\b\n\u0000\u001a\u0004\b\n\u0010\u0013R\u0013\u0010\u0002\u001a\u00020\u00038\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u0002\u0010\u0013R\u0013\u0010\u0004\u001a\u00020\u00038\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u0004\u0010\u0013R\u0013\u0010\u000e\u001a\u00020\u00038\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u000e\u0010\u0013R\u0013\u0010\r\u001a\u00020\u00038\u0007¢\u0006\b\n\u0000\u001a\u0004\b\r\u0010\u0013R\u0013\u0010\u0007\u001a\u00020\u00068\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u0007\u0010\u0014¨\u0006\""}, d2 = {"Lokhttp3/CacheControl;", "", "noCache", "", "noStore", "maxAgeSeconds", "", "sMaxAgeSeconds", "isPrivate", "isPublic", "mustRevalidate", "maxStaleSeconds", "minFreshSeconds", "onlyIfCached", "noTransform", "immutable", "headerValue", "", "(ZZIIZZZIIZZZLjava/lang/String;)V", "()Z", "()I", "-deprecated_immutable", "-deprecated_maxAgeSeconds", "-deprecated_maxStaleSeconds", "-deprecated_minFreshSeconds", "-deprecated_mustRevalidate", "-deprecated_noCache", "-deprecated_noStore", "-deprecated_noTransform", "-deprecated_onlyIfCached", "-deprecated_sMaxAgeSeconds", "toString", "Builder", "Companion", "okhttp"}, k = 1, mv = {1, 4, 0})
/* loaded from: classes3.dex */
public final class CacheControl {
private String headerValue;
private final boolean immutable;
private final boolean isPrivate;
private final boolean isPublic;
private final int maxAgeSeconds;
private final int maxStaleSeconds;
private final int minFreshSeconds;
private final boolean mustRevalidate;
private final boolean noCache;
private final boolean noStore;
private final boolean noTransform;
private final boolean onlyIfCached;
private final int sMaxAgeSeconds;
/* renamed from: Companion, reason: from kotlin metadata */
public static final Companion INSTANCE = new Companion(null);
public static final CacheControl FORCE_NETWORK = new Builder().noCache().build();
public static final CacheControl FORCE_CACHE = new Builder().onlyIfCached().maxStale(Integer.MAX_VALUE, TimeUnit.SECONDS).build();
@JvmStatic
public static final CacheControl parse(Headers headers) {
return INSTANCE.parse(headers);
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "immutable", imports = {}))
/* renamed from: -deprecated_immutable, reason: not valid java name and from getter */
public final boolean getImmutable() {
return this.immutable;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "maxAgeSeconds", imports = {}))
/* renamed from: -deprecated_maxAgeSeconds, reason: not valid java name and from getter */
public final int getMaxAgeSeconds() {
return this.maxAgeSeconds;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "maxStaleSeconds", imports = {}))
/* renamed from: -deprecated_maxStaleSeconds, reason: not valid java name and from getter */
public final int getMaxStaleSeconds() {
return this.maxStaleSeconds;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "minFreshSeconds", imports = {}))
/* renamed from: -deprecated_minFreshSeconds, reason: not valid java name and from getter */
public final int getMinFreshSeconds() {
return this.minFreshSeconds;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "mustRevalidate", imports = {}))
/* renamed from: -deprecated_mustRevalidate, reason: not valid java name and from getter */
public final boolean getMustRevalidate() {
return this.mustRevalidate;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "noCache", imports = {}))
/* renamed from: -deprecated_noCache, reason: not valid java name and from getter */
public final boolean getNoCache() {
return this.noCache;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "noStore", imports = {}))
/* renamed from: -deprecated_noStore, reason: not valid java name and from getter */
public final boolean getNoStore() {
return this.noStore;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "noTransform", imports = {}))
/* renamed from: -deprecated_noTransform, reason: not valid java name and from getter */
public final boolean getNoTransform() {
return this.noTransform;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "onlyIfCached", imports = {}))
/* renamed from: -deprecated_onlyIfCached, reason: not valid java name and from getter */
public final boolean getOnlyIfCached() {
return this.onlyIfCached;
}
@Deprecated(level = DeprecationLevel.ERROR, message = "moved to val", replaceWith = @ReplaceWith(expression = "sMaxAgeSeconds", imports = {}))
/* renamed from: -deprecated_sMaxAgeSeconds, reason: not valid java name and from getter */
public final int getSMaxAgeSeconds() {
return this.sMaxAgeSeconds;
}
public final boolean immutable() {
return this.immutable;
}
/* renamed from: isPrivate, reason: from getter */
public final boolean getIsPrivate() {
return this.isPrivate;
}
/* renamed from: isPublic, reason: from getter */
public final boolean getIsPublic() {
return this.isPublic;
}
public final int maxAgeSeconds() {
return this.maxAgeSeconds;
}
public final int maxStaleSeconds() {
return this.maxStaleSeconds;
}
public final int minFreshSeconds() {
return this.minFreshSeconds;
}
public final boolean mustRevalidate() {
return this.mustRevalidate;
}
public final boolean noCache() {
return this.noCache;
}
public final boolean noStore() {
return this.noStore;
}
public final boolean noTransform() {
return this.noTransform;
}
public final boolean onlyIfCached() {
return this.onlyIfCached;
}
public final int sMaxAgeSeconds() {
return this.sMaxAgeSeconds;
}
private CacheControl(boolean z, boolean z2, int i, int i2, boolean z3, boolean z4, boolean z5, int i3, int i4, boolean z6, boolean z7, boolean z8, String str) {
this.noCache = z;
this.noStore = z2;
this.maxAgeSeconds = i;
this.sMaxAgeSeconds = i2;
this.isPrivate = z3;
this.isPublic = z4;
this.mustRevalidate = z5;
this.maxStaleSeconds = i3;
this.minFreshSeconds = i4;
this.onlyIfCached = z6;
this.noTransform = z7;
this.immutable = z8;
this.headerValue = str;
}
public /* synthetic */ CacheControl(boolean z, boolean z2, int i, int i2, boolean z3, boolean z4, boolean z5, int i3, int i4, boolean z6, boolean z7, boolean z8, String str, DefaultConstructorMarker defaultConstructorMarker) {
this(z, z2, i, i2, z3, z4, z5, i3, i4, z6, z7, z8, str);
}
public String toString() {
String str = this.headerValue;
if (str != null) {
return str;
}
StringBuilder sb = new StringBuilder();
if (this.noCache) {
sb.append("no-cache, ");
}
if (this.noStore) {
sb.append("no-store, ");
}
if (this.maxAgeSeconds != -1) {
sb.append("max-age=").append(this.maxAgeSeconds).append(", ");
}
if (this.sMaxAgeSeconds != -1) {
sb.append("s-maxage=").append(this.sMaxAgeSeconds).append(", ");
}
if (this.isPrivate) {
sb.append("private, ");
}
if (this.isPublic) {
sb.append("public, ");
}
if (this.mustRevalidate) {
sb.append("must-revalidate, ");
}
if (this.maxStaleSeconds != -1) {
sb.append("max-stale=").append(this.maxStaleSeconds).append(", ");
}
if (this.minFreshSeconds != -1) {
sb.append("min-fresh=").append(this.minFreshSeconds).append(", ");
}
if (this.onlyIfCached) {
sb.append("only-if-cached, ");
}
if (this.noTransform) {
sb.append("no-transform, ");
}
if (this.immutable) {
sb.append("immutable, ");
}
if (sb.length() == 0) {
return "";
}
sb.delete(sb.length() - 2, sb.length());
String sb2 = sb.toString();
Intrinsics.checkNotNullExpressionValue(sb2, "StringBuilder().apply(builderAction).toString()");
this.headerValue = sb2;
return sb2;
}
/* compiled from: CacheControl.kt */
@Metadata(bv = {1, 0, 3}, d1 = {"\u00000\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\b\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\t\n\u0000\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J\u0006\u0010\r\u001a\u00020\u000eJ\u0006\u0010\u0003\u001a\u00020\u0000J\u0016\u0010\u000f\u001a\u00020\u00002\u0006\u0010\u000f\u001a\u00020\u00062\u0006\u0010\u0010\u001a\u00020\u0011J\u0016\u0010\u0012\u001a\u00020\u00002\u0006\u0010\u0012\u001a\u00020\u00062\u0006\u0010\u0010\u001a\u00020\u0011J\u0016\u0010\u0013\u001a\u00020\u00002\u0006\u0010\u0013\u001a\u00020\u00062\u0006\u0010\u0010\u001a\u00020\u0011J\u0006\u0010\t\u001a\u00020\u0000J\u0006\u0010\n\u001a\u00020\u0000J\u0006\u0010\u000b\u001a\u00020\u0000J\u0006\u0010\f\u001a\u00020\u0000J\f\u0010\u0014\u001a\u00020\u0006*\u00020\u0015H\u0002R\u000e\u0010\u0003\u001a\u00020\u0004X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0005\u001a\u00020\u0006X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0007\u001a\u00020\u0006X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\b\u001a\u00020\u0006X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\t\u001a\u00020\u0004X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\n\u001a\u00020\u0004X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u000b\u001a\u00020\u0004X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\f\u001a\u00020\u0004X\u0082\u000e¢\u0006\u0002\n\u0000¨\u0006\u0016"}, d2 = {"Lokhttp3/CacheControl$Builder;", "", "()V", "immutable", "", "maxAgeSeconds", "", "maxStaleSeconds", "minFreshSeconds", "noCache", "noStore", "noTransform", "onlyIfCached", OperatingSystem.JsonKeys.BUILD, "Lokhttp3/CacheControl;", "maxAge", "timeUnit", "Ljava/util/concurrent/TimeUnit;", "maxStale", "minFresh", "clampToInt", "", "okhttp"}, k = 1, mv = {1, 4, 0})
/* loaded from: classes3.dex */
public static final class Builder {
private boolean immutable;
private int maxAgeSeconds = -1;
private int maxStaleSeconds = -1;
private int minFreshSeconds = -1;
private boolean noCache;
private boolean noStore;
private boolean noTransform;
private boolean onlyIfCached;
private final int clampToInt(long j) {
if (j > Integer.MAX_VALUE) {
return Integer.MAX_VALUE;
}
return (int) j;
}
public final Builder noCache() {
this.noCache = true;
return this;
}
public final Builder noStore() {
this.noStore = true;
return this;
}
public final Builder maxAge(int maxAge, TimeUnit timeUnit) {
Intrinsics.checkNotNullParameter(timeUnit, "timeUnit");
if (!(maxAge >= 0)) {
throw new IllegalArgumentException(("maxAge < 0: " + maxAge).toString());
}
this.maxAgeSeconds = clampToInt(timeUnit.toSeconds(maxAge));
return this;
}
public final Builder maxStale(int maxStale, TimeUnit timeUnit) {
Intrinsics.checkNotNullParameter(timeUnit, "timeUnit");
if (!(maxStale >= 0)) {
throw new IllegalArgumentException(("maxStale < 0: " + maxStale).toString());
}
this.maxStaleSeconds = clampToInt(timeUnit.toSeconds(maxStale));
return this;
}
public final Builder minFresh(int minFresh, TimeUnit timeUnit) {
Intrinsics.checkNotNullParameter(timeUnit, "timeUnit");
if (!(minFresh >= 0)) {
throw new IllegalArgumentException(("minFresh < 0: " + minFresh).toString());
}
this.minFreshSeconds = clampToInt(timeUnit.toSeconds(minFresh));
return this;
}
public final Builder onlyIfCached() {
this.onlyIfCached = true;
return this;
}
public final Builder noTransform() {
this.noTransform = true;
return this;
}
public final Builder immutable() {
this.immutable = true;
return this;
}
public final CacheControl build() {
return new CacheControl(this.noCache, this.noStore, this.maxAgeSeconds, -1, false, false, false, this.maxStaleSeconds, this.minFreshSeconds, this.onlyIfCached, this.noTransform, this.immutable, null, null);
}
}
/* compiled from: CacheControl.kt */
@Metadata(bv = {1, 0, 3}, d1 = {"\u0000&\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\u0010\u000e\n\u0002\b\u0003\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u0010\u0010\u0006\u001a\u00020\u00042\u0006\u0010\u0007\u001a\u00020\bH\u0007J\u001e\u0010\t\u001a\u00020\n*\u00020\u000b2\u0006\u0010\f\u001a\u00020\u000b2\b\b\u0002\u0010\r\u001a\u00020\nH\u0002R\u0010\u0010\u0003\u001a\u00020\u00048\u0006X\u0087\u0004¢\u0006\u0002\n\u0000R\u0010\u0010\u0005\u001a\u00020\u00048\u0006X\u0087\u0004¢\u0006\u0002\n\u0000¨\u0006\u000e"}, d2 = {"Lokhttp3/CacheControl$Companion;", "", "()V", "FORCE_CACHE", "Lokhttp3/CacheControl;", "FORCE_NETWORK", "parse", "headers", "Lokhttp3/Headers;", "indexOfElement", "", "", "characters", SpellCheckPlugin.START_INDEX_KEY, "okhttp"}, k = 1, mv = {1, 4, 0})
/* loaded from: classes3.dex */
public static final class Companion {
private Companion() {
}
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
/* JADX WARN: Removed duplicated region for block: B:10:0x004e */
/* JADX WARN: Removed duplicated region for block: B:29:0x0101 */
/* JADX WARN: Removed duplicated region for block: B:33:0x0105 */
@kotlin.jvm.JvmStatic
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public final okhttp3.CacheControl parse(okhttp3.Headers r34) {
/*
Method dump skipped, instructions count: 452
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: okhttp3.CacheControl.Companion.parse(okhttp3.Headers):okhttp3.CacheControl");
}
static /* synthetic */ int indexOfElement$default(Companion companion, String str, String str2, int i, int i2, Object obj) {
if ((i2 & 2) != 0) {
i = 0;
}
return companion.indexOfElement(str, str2, i);
}
private final int indexOfElement(String str, String str2, int i) {
int length = str.length();
while (i < length) {
if (StringsKt.contains$default((CharSequence) str2, str.charAt(i), false, 2, (Object) null)) {
return i;
}
i++;
}
return str.length();
}
}
}