what-the-bank/sources/okhttp3/internal/Util.java

971 lines
33 KiB
Java

package okhttp3.internal;
import com.google.common.net.HttpHeaders;
import java.io.Closeable;
import java.io.File;
import java.io.IOException;
import java.io.InterruptedIOException;
import java.net.InetSocketAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketAddress;
import java.net.SocketTimeoutException;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.TimeZone;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
import o.AbstractC14853gaL;
import o.C14851gaI;
import o.C14854gaM;
import o.C14866gag;
import o.C14881gav;
import o.C14887gbC;
import o.C14947gcl;
import o.C14957gcv;
import o.C14973gde;
import o.C15111ghZ;
import o.C15155gij;
import o.C15163gir;
import o.InterfaceC14890gbN;
import o.InterfaceC14894gbR;
import o.InterfaceC15148gic;
import o.InterfaceC15149gid;
import o.InterfaceC15168giw;
import o.gbF;
import o.gcH;
import o.gcQ;
import o.gdP;
import o.gdW;
import o.gdZ;
import o.giD;
import okhttp3.Call;
import okhttp3.EventListener;
import okhttp3.Headers;
import okhttp3.HttpUrl;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.RequestBody;
import okhttp3.Response;
import okhttp3.ResponseBody;
import okhttp3.internal.http2.Header;
import okhttp3.internal.io.FileSystem;
/* loaded from: classes.dex */
public final class Util {
public static final byte[] EMPTY_BYTE_ARRAY;
public static final Headers EMPTY_HEADERS = Headers.Companion.of(new String[0]);
public static final RequestBody EMPTY_REQUEST;
public static final ResponseBody EMPTY_RESPONSE;
private static final C15163gir UNICODE_BOMS;
public static final TimeZone UTC;
private static final gdW VERIFY_AS_IP_ADDRESS;
public static final boolean assertionsEnabled;
public static final String okHttpName;
public static final String userAgent = "okhttp/4.11.0";
public static final int and(byte b, int i) {
return b & i;
}
public static final int and(short s, int i) {
return s & i;
}
public static final long and(int i, long j) {
return i & j;
}
public static final int parseHexDigit(char c) {
if ('0' <= c && c < ':') {
return c - '0';
}
if ('a' <= c && c < 'g') {
return c - 'W';
}
if ('A' > c || c >= 'G') {
return -1;
}
return c - '7';
}
static {
byte[] bArr = new byte[0];
EMPTY_BYTE_ARRAY = bArr;
EMPTY_RESPONSE = ResponseBody.Companion.create$default(ResponseBody.Companion, bArr, (MediaType) null, 1, (Object) null);
EMPTY_REQUEST = RequestBody.Companion.create$default(RequestBody.Companion, bArr, (MediaType) null, 0, 0, 7, (Object) null);
C15163gir.LWm lWm = C15163gir.c;
C15155gij.LWm lWm2 = C15155gij.c;
C15155gij b = C15155gij.LWm.b("efbbbf");
C15155gij.LWm lWm3 = C15155gij.c;
C15155gij b2 = C15155gij.LWm.b("feff");
C15155gij.LWm lWm4 = C15155gij.c;
C15155gij b3 = C15155gij.LWm.b("fffe");
C15155gij.LWm lWm5 = C15155gij.c;
C15155gij b4 = C15155gij.LWm.b("0000ffff");
C15155gij.LWm lWm6 = C15155gij.c;
UNICODE_BOMS = lWm.a(b, b2, b3, b4, C15155gij.LWm.b("ffff0000"));
TimeZone timeZone = TimeZone.getTimeZone("GMT");
C14957gcv.e(timeZone);
UTC = timeZone;
VERIFY_AS_IP_ADDRESS = new gdW("([0-9a-fA-F]*:[0-9a-fA-F:.]*)|([\\d.]+)");
assertionsEnabled = false;
String name = OkHttpClient.class.getName();
C14957gcv.c((Object) name, "");
okHttpName = gdZ.c(gdZ.b(name, "okhttp3."), (CharSequence) "Client");
}
public static final void checkOffsetAndCount(long j, long j2, long j3) {
if ((j2 | j3) < 0 || j2 > j || j - j2 < j3) {
throw new ArrayIndexOutOfBoundsException();
}
}
public static final ThreadFactory threadFactory(final String str, final boolean z) {
C14957gcv.e(str, "");
return new ThreadFactory(str, z) { // from class: okhttp3.internal.Util$$ExternalSyntheticLambda0
public final String f$0;
public final boolean f$1;
@Override // java.util.concurrent.ThreadFactory
public final Thread newThread(Runnable runnable) {
Thread m493threadFactory$lambda1;
m493threadFactory$lambda1 = Util.m493threadFactory$lambda1(this.f$0, this.f$1, runnable);
return m493threadFactory$lambda1;
}
{
this.f$0 = str;
this.f$1 = z;
}
};
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: threadFactory$lambda-1, reason: not valid java name */
public static final Thread m493threadFactory$lambda1(String str, boolean z, Runnable runnable) {
C14957gcv.e(str, "");
Thread thread = new Thread(runnable, str);
thread.setDaemon(z);
return thread;
}
public static final String[] intersect(String[] strArr, String[] strArr2, Comparator<? super String> comparator) {
C14957gcv.e(strArr, "");
C14957gcv.e(strArr2, "");
C14957gcv.e(comparator, "");
ArrayList arrayList = new ArrayList();
int length = strArr.length;
int i = 0;
while (i < length) {
String str = strArr[i];
i++;
int length2 = strArr2.length;
int i2 = 0;
while (true) {
if (i2 < length2) {
String str2 = strArr2[i2];
i2++;
if (comparator.compare(str, str2) == 0) {
arrayList.add(str);
break;
}
}
}
}
Object[] array = arrayList.toArray(new String[0]);
if (array != null) {
return (String[]) array;
}
throw new NullPointerException("null cannot be cast to non-null type kotlin.Array<T of kotlin.collections.ArraysKt__ArraysJVMKt.toTypedArray>");
}
/* JADX WARN: Multi-variable type inference failed */
public static final boolean hasIntersection(String[] strArr, String[] strArr2, Comparator<? super String> comparator) {
C14957gcv.e(strArr, "");
C14957gcv.e(comparator, "");
if (strArr.length != 0 && strArr2 != null && strArr2.length != 0) {
int length = strArr.length;
int i = 0;
while (i < length) {
String str = strArr[i];
i++;
C14957gcv.e(strArr2, "");
C14947gcl c14947gcl = new C14947gcl(strArr2);
while (c14947gcl.hasNext()) {
if (comparator.compare(str, (String) c14947gcl.next()) == 0) {
return true;
}
}
}
}
return false;
}
public static /* synthetic */ String toHostHeader$default(HttpUrl httpUrl, boolean z, int i, Object obj) {
if ((i & 1) != 0) {
z = false;
}
return toHostHeader(httpUrl, z);
}
public static final String toHostHeader(HttpUrl httpUrl, boolean z) {
String host;
C14957gcv.e(httpUrl, "");
if (gdZ.d((CharSequence) httpUrl.host(), (CharSequence) ":", false)) {
StringBuilder sb = new StringBuilder("[");
sb.append(httpUrl.host());
sb.append(']');
host = sb.toString();
} else {
host = httpUrl.host();
}
if (!z && httpUrl.port() == HttpUrl.Companion.defaultPort(httpUrl.scheme())) {
return host;
}
StringBuilder sb2 = new StringBuilder();
sb2.append(host);
sb2.append(':');
sb2.append(httpUrl.port());
return sb2.toString();
}
public static final String[] concat(String[] strArr, String str) {
C14957gcv.e(strArr, "");
C14957gcv.e(str, "");
Object[] copyOf = Arrays.copyOf(strArr, strArr.length + 1);
C14957gcv.c(copyOf, "");
String[] strArr2 = (String[]) copyOf;
C14957gcv.e(strArr2, "");
strArr2[strArr2.length - 1] = str;
return strArr2;
}
public static /* synthetic */ int indexOfFirstNonAsciiWhitespace$default(String str, int i, int i2, int i3, Object obj) {
if ((i3 & 1) != 0) {
i = 0;
}
if ((i3 & 2) != 0) {
i2 = str.length();
}
return indexOfFirstNonAsciiWhitespace(str, i, i2);
}
public static final int indexOfFirstNonAsciiWhitespace(String str, int i, int i2) {
C14957gcv.e(str, "");
while (i < i2) {
char charAt = str.charAt(i);
if (charAt != '\t' && charAt != '\n' && charAt != '\f' && charAt != '\r' && charAt != ' ') {
return i;
}
i++;
}
return i2;
}
public static /* synthetic */ int indexOfLastNonAsciiWhitespace$default(String str, int i, int i2, int i3, Object obj) {
if ((i3 & 1) != 0) {
i = 0;
}
if ((i3 & 2) != 0) {
i2 = str.length();
}
return indexOfLastNonAsciiWhitespace(str, i, i2);
}
public static final int indexOfLastNonAsciiWhitespace(String str, int i, int i2) {
C14957gcv.e(str, "");
int i3 = i2 - 1;
if (i <= i3) {
while (true) {
char charAt = str.charAt(i3);
if (charAt != '\t' && charAt != '\n' && charAt != '\f' && charAt != '\r' && charAt != ' ') {
return i3 + 1;
}
if (i3 == i) {
break;
}
i3--;
}
}
return i;
}
public static /* synthetic */ String trimSubstring$default(String str, int i, int i2, int i3, Object obj) {
if ((i3 & 1) != 0) {
i = 0;
}
if ((i3 & 2) != 0) {
i2 = str.length();
}
return trimSubstring(str, i, i2);
}
public static final String trimSubstring(String str, int i, int i2) {
C14957gcv.e(str, "");
int indexOfFirstNonAsciiWhitespace = indexOfFirstNonAsciiWhitespace(str, i, i2);
String substring = str.substring(indexOfFirstNonAsciiWhitespace, indexOfLastNonAsciiWhitespace(str, indexOfFirstNonAsciiWhitespace, i2));
C14957gcv.c((Object) substring, "");
return substring;
}
public static /* synthetic */ int delimiterOffset$default(String str, String str2, int i, int i2, int i3, Object obj) {
if ((i3 & 2) != 0) {
i = 0;
}
if ((i3 & 4) != 0) {
i2 = str.length();
}
return delimiterOffset(str, str2, i, i2);
}
public static final int delimiterOffset(String str, String str2, int i, int i2) {
C14957gcv.e(str, "");
C14957gcv.e(str2, "");
while (i < i2) {
String str3 = str2;
char charAt = str.charAt(i);
C14957gcv.e(str3, "");
if (gdZ.a((CharSequence) str3, charAt, 0, false) >= 0) {
return i;
}
i++;
}
return i2;
}
public static /* synthetic */ int delimiterOffset$default(String str, char c, int i, int i2, int i3, Object obj) {
if ((i3 & 2) != 0) {
i = 0;
}
if ((i3 & 4) != 0) {
i2 = str.length();
}
return delimiterOffset(str, c, i, i2);
}
public static final int delimiterOffset(String str, char c, int i, int i2) {
C14957gcv.e(str, "");
while (i < i2) {
if (str.charAt(i) == c) {
return i;
}
i++;
}
return i2;
}
public static final int indexOfControlOrNonAscii(String str) {
C14957gcv.e(str, "");
int length = str.length();
for (int i = 0; i < length; i++) {
char charAt = str.charAt(i);
if (C14957gcv.a(charAt, 31) <= 0 || C14957gcv.a(charAt, 127) >= 0) {
return i;
}
}
return -1;
}
public static final boolean canParseAsIpAddress(String str) {
C14957gcv.e(str, "");
gdW gdw = VERIFY_AS_IP_ADDRESS;
String str2 = str;
C14957gcv.e(str2, "");
return gdw.e.matcher(str2).matches();
}
public static final boolean isSensitiveHeader(String str) {
C14957gcv.e(str, "");
return gdZ.a(str, HttpHeaders.AUTHORIZATION, true) || gdZ.a(str, HttpHeaders.COOKIE, true) || gdZ.a(str, HttpHeaders.PROXY_AUTHORIZATION, true) || gdZ.a(str, HttpHeaders.SET_COOKIE, true);
}
public static final String format(String str, Object... objArr) {
C14957gcv.e(str, "");
C14957gcv.e(objArr, "");
gcH gch = gcH.d;
Locale locale = Locale.US;
Object[] copyOf = Arrays.copyOf(objArr, objArr.length);
String format = String.format(locale, str, Arrays.copyOf(copyOf, copyOf.length));
C14957gcv.c((Object) format, "");
return format;
}
public static final Charset readBomAsCharset(InterfaceC15149gid interfaceC15149gid, Charset charset) throws IOException {
Charset forName;
C14957gcv.e(interfaceC15149gid, "");
C14957gcv.e(charset, "");
int c = interfaceC15149gid.c(UNICODE_BOMS);
if (c == -1) {
return charset;
}
if (c == 0) {
Charset charset2 = StandardCharsets.UTF_8;
C14957gcv.c(charset2, "");
return charset2;
}
if (c == 1) {
Charset charset3 = StandardCharsets.UTF_16BE;
C14957gcv.c(charset3, "");
return charset3;
}
if (c == 2) {
Charset charset4 = StandardCharsets.UTF_16LE;
C14957gcv.c(charset4, "");
return charset4;
}
if (c == 3) {
gdP gdp = gdP.b;
Charset charset5 = gdP.d;
if (charset5 != null) {
return charset5;
}
forName = Charset.forName("UTF-32BE");
C14957gcv.c(forName, "");
gdP.d = forName;
} else if (c == 4) {
gdP gdp2 = gdP.b;
Charset charset6 = gdP.c;
if (charset6 != null) {
return charset6;
}
forName = Charset.forName("UTF-32LE");
C14957gcv.c(forName, "");
gdP.c = forName;
} else {
throw new AssertionError();
}
return forName;
}
public static final int checkDuration(String str, long j, TimeUnit timeUnit) {
C14957gcv.e(str, "");
if (j < 0) {
throw new IllegalStateException(C14957gcv.c(str, (Object) " < 0").toString());
}
if (timeUnit == null) {
throw new IllegalStateException("unit == null".toString());
}
long millis = timeUnit.toMillis(j);
if (millis > 2147483647L) {
throw new IllegalArgumentException(C14957gcv.c(str, (Object) " too large.").toString());
}
if (millis != 0 || j <= 0) {
return (int) millis;
}
throw new IllegalArgumentException(C14957gcv.c(str, (Object) " too small.").toString());
}
public static final Headers toHeaders(List<Header> list) {
C14957gcv.e(list, "");
Headers.Builder builder = new Headers.Builder();
for (Header header : list) {
C15155gij component1 = header.component1();
C15155gij component2 = header.component2();
String str = component1.d;
if (str == null) {
byte[] b = component1.b();
C14957gcv.e(b, "");
String str2 = new String(b, gdP.a);
component1.d = str2;
str = str2;
}
String str3 = component2.d;
if (str3 == null) {
byte[] b2 = component2.b();
C14957gcv.e(b2, "");
String str4 = new String(b2, gdP.a);
component2.d = str4;
str3 = str4;
}
builder.addLenient$okhttp(str, str3);
}
return builder.build();
}
public static final List<Header> toHeaderList(Headers headers) {
Iterable c14973gde;
C14957gcv.e(headers, "");
int size = headers.size();
if (size <= Integer.MIN_VALUE) {
C14973gde.LWm lWm = C14973gde.c;
c14973gde = C14973gde.f;
} else {
c14973gde = new C14973gde(0, size - 1);
}
Iterable iterable = c14973gde;
C14957gcv.e(iterable, "");
ArrayList arrayList = new ArrayList(iterable instanceof Collection ? ((Collection) iterable).size() : 10);
Iterator it = iterable.iterator();
while (it.hasNext()) {
int a = ((AbstractC14853gaL) it).a();
arrayList.add(new Header(headers.name(a), headers.value(a)));
}
return arrayList;
}
public static final boolean canReuseConnectionFor(HttpUrl httpUrl, HttpUrl httpUrl2) {
C14957gcv.e(httpUrl, "");
C14957gcv.e(httpUrl2, "");
return C14957gcv.b((Object) httpUrl.host(), (Object) httpUrl2.host()) && httpUrl.port() == httpUrl2.port() && C14957gcv.b((Object) httpUrl.scheme(), (Object) httpUrl2.scheme());
}
public static final EventListener.Factory asFactory(final EventListener eventListener) {
C14957gcv.e(eventListener, "");
return new EventListener.Factory(eventListener) { // from class: okhttp3.internal.Util$$ExternalSyntheticLambda1
public final EventListener f$0;
@Override // okhttp3.EventListener.Factory
public final EventListener create(Call call) {
EventListener m492asFactory$lambda8;
m492asFactory$lambda8 = Util.m492asFactory$lambda8(this.f$0, call);
return m492asFactory$lambda8;
}
{
this.f$0 = eventListener;
}
};
}
public static final void writeMedium(InterfaceC15148gic interfaceC15148gic, int i) throws IOException {
C14957gcv.e(interfaceC15148gic, "");
interfaceC15148gic.b((i >>> 16) & 255);
interfaceC15148gic.b((i >>> 8) & 255);
interfaceC15148gic.b(i & 255);
}
public static final int readMedium(InterfaceC15149gid interfaceC15149gid) throws IOException {
C14957gcv.e(interfaceC15149gid, "");
return and(interfaceC15149gid.f(), 255) | (and(interfaceC15149gid.f(), 255) << 16) | (and(interfaceC15149gid.f(), 255) << 8);
}
public static final boolean skipAll(giD gid, int i, TimeUnit timeUnit) throws IOException {
C14957gcv.e(gid, "");
C14957gcv.e(timeUnit, "");
long nanoTime = System.nanoTime();
long deadlineNanoTime = gid.timeout().hasDeadline() ? gid.timeout().deadlineNanoTime() - nanoTime : Long.MAX_VALUE;
gid.timeout().deadlineNanoTime(Math.min(deadlineNanoTime, timeUnit.toNanos(i)) + nanoTime);
try {
C15111ghZ c15111ghZ = new C15111ghZ();
while (gid.read(c15111ghZ, 8192L) != -1) {
c15111ghZ.j(c15111ghZ.c);
}
if (deadlineNanoTime == Long.MAX_VALUE) {
gid.timeout().clearDeadline();
} else {
gid.timeout().deadlineNanoTime(nanoTime + deadlineNanoTime);
}
return true;
} catch (InterruptedIOException unused) {
if (deadlineNanoTime == Long.MAX_VALUE) {
gid.timeout().clearDeadline();
} else {
gid.timeout().deadlineNanoTime(nanoTime + deadlineNanoTime);
}
return false;
} catch (Throwable th) {
if (deadlineNanoTime == Long.MAX_VALUE) {
gid.timeout().clearDeadline();
} else {
gid.timeout().deadlineNanoTime(nanoTime + deadlineNanoTime);
}
throw th;
}
}
public static final boolean discard(giD gid, int i, TimeUnit timeUnit) {
C14957gcv.e(gid, "");
C14957gcv.e(timeUnit, "");
try {
return skipAll(gid, i, timeUnit);
} catch (IOException unused) {
return false;
}
}
public static final String peerName(Socket socket) {
C14957gcv.e(socket, "");
SocketAddress remoteSocketAddress = socket.getRemoteSocketAddress();
if (!(remoteSocketAddress instanceof InetSocketAddress)) {
return remoteSocketAddress.toString();
}
String hostName = ((InetSocketAddress) remoteSocketAddress).getHostName();
C14957gcv.c((Object) hostName, "");
return hostName;
}
public static final boolean isHealthy(Socket socket, InterfaceC15149gid interfaceC15149gid) {
C14957gcv.e(socket, "");
C14957gcv.e(interfaceC15149gid, "");
try {
int soTimeout = socket.getSoTimeout();
try {
socket.setSoTimeout(1);
boolean j = interfaceC15149gid.j();
socket.setSoTimeout(soTimeout);
return true ^ j;
} catch (Throwable th) {
socket.setSoTimeout(soTimeout);
throw th;
}
} catch (SocketTimeoutException unused) {
return true;
} catch (IOException unused2) {
return false;
}
}
public static final void ignoreIoExceptions(InterfaceC14890gbN<C14866gag> interfaceC14890gbN) {
C14957gcv.e(interfaceC14890gbN, "");
try {
interfaceC14890gbN.invoke();
} catch (IOException unused) {
}
}
public static final void threadName(String str, InterfaceC14890gbN<C14866gag> interfaceC14890gbN) {
C14957gcv.e(str, "");
C14957gcv.e(interfaceC14890gbN, "");
Thread currentThread = Thread.currentThread();
String name = currentThread.getName();
currentThread.setName(str);
try {
interfaceC14890gbN.invoke();
} finally {
currentThread.setName(name);
}
}
public static /* synthetic */ int indexOfNonWhitespace$default(String str, int i, int i2, Object obj) {
if ((i2 & 1) != 0) {
i = 0;
}
return indexOfNonWhitespace(str, i);
}
public static final int indexOfNonWhitespace(String str, int i) {
C14957gcv.e(str, "");
int length = str.length();
while (i < length) {
char charAt = str.charAt(i);
if (charAt != ' ' && charAt != '\t') {
return i;
}
i++;
}
return str.length();
}
public static final long headersContentLength(Response response) {
C14957gcv.e(response, "");
String str = response.headers().get(HttpHeaders.CONTENT_LENGTH);
if (str != null) {
return toLongOrDefault(str, -1L);
}
return -1L;
}
public static final long toLongOrDefault(String str, long j) {
C14957gcv.e(str, "");
try {
return Long.parseLong(str);
} catch (NumberFormatException unused) {
return j;
}
}
public static final int toNonNegativeInt(String str, int i) {
Long valueOf;
if (str == null) {
valueOf = null;
} else {
try {
valueOf = Long.valueOf(Long.parseLong(str));
} catch (NumberFormatException unused) {
return i;
}
}
if (valueOf == null) {
return i;
}
long longValue = valueOf.longValue();
if (longValue > 2147483647L) {
return Integer.MAX_VALUE;
}
if (longValue < 0) {
return 0;
}
return (int) longValue;
}
public static final <T> List<T> toImmutableList(List<? extends T> list) {
C14957gcv.e(list, "");
List<? extends T> list2 = list;
C14957gcv.e(list2, "");
List<T> unmodifiableList = Collections.unmodifiableList(new ArrayList(list2));
C14957gcv.c(unmodifiableList, "");
return unmodifiableList;
}
@SafeVarargs
public static final <T> List<T> immutableListOf(T... tArr) {
C14957gcv.e(tArr, "");
Object[] objArr = (Object[]) tArr.clone();
List<T> unmodifiableList = Collections.unmodifiableList(C14881gav.e(Arrays.copyOf(objArr, objArr.length)));
C14957gcv.c(unmodifiableList, "");
return unmodifiableList;
}
public static final <K, V> Map<K, V> toImmutableMap(Map<K, ? extends V> map) {
C14957gcv.e(map, "");
if (!map.isEmpty()) {
Map<K, V> unmodifiableMap = Collections.unmodifiableMap(new LinkedHashMap(map));
C14957gcv.c(unmodifiableMap, "");
return unmodifiableMap;
}
C14854gaM c14854gaM = C14854gaM.c;
C14957gcv.d(c14854gaM, "");
return c14854gaM;
}
public static final void closeQuietly(Closeable closeable) {
C14957gcv.e(closeable, "");
try {
closeable.close();
} catch (RuntimeException e) {
throw e;
} catch (Exception unused) {
}
}
public static final void closeQuietly(Socket socket) {
C14957gcv.e(socket, "");
try {
socket.close();
} catch (AssertionError e) {
throw e;
} catch (RuntimeException e2) {
if (!C14957gcv.b((Object) e2.getMessage(), (Object) "bio == null")) {
throw e2;
}
} catch (Exception unused) {
}
}
public static final void closeQuietly(ServerSocket serverSocket) {
C14957gcv.e(serverSocket, "");
try {
serverSocket.close();
} catch (RuntimeException e) {
throw e;
} catch (Exception unused) {
}
}
public static final boolean isCivilized(FileSystem fileSystem, File file) {
C14957gcv.e(fileSystem, "");
C14957gcv.e(file, "");
InterfaceC15168giw sink = fileSystem.sink(file);
try {
InterfaceC15168giw interfaceC15168giw = sink;
try {
fileSystem.delete(file);
gbF.d(sink, null);
return true;
} catch (IOException unused) {
C14866gag c14866gag = C14866gag.c;
gbF.d(sink, null);
fileSystem.delete(file);
return false;
}
} finally {
}
}
public static final String toHexString(long j) {
String hexString = Long.toHexString(j);
C14957gcv.c((Object) hexString, "");
return hexString;
}
public static final String toHexString(int i) {
String hexString = Integer.toHexString(i);
C14957gcv.c((Object) hexString, "");
return hexString;
}
public static final void wait(Object obj) {
C14957gcv.e(obj, "");
obj.wait();
}
public static final void notify(Object obj) {
C14957gcv.e(obj, "");
obj.notify();
}
public static final void notifyAll(Object obj) {
C14957gcv.e(obj, "");
obj.notifyAll();
}
/* JADX WARN: Code restructure failed: missing block: B:17:0x003e, code lost:
if (o.C14957gcv.b((java.lang.Object) r7, (java.lang.Object) "delegate") != false) goto L22;
*/
/* JADX WARN: Code restructure failed: missing block: B:18:0x0040, code lost:
r5 = readFieldOrNull(r5, java.lang.Object.class, "delegate");
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public static final <T> T readFieldOrNull(java.lang.Object r5, java.lang.Class<T> r6, java.lang.String r7) {
/*
L0:
java.lang.String r0 = ""
o.C14957gcv.e(r5, r0)
o.C14957gcv.e(r6, r0)
o.C14957gcv.e(r7, r0)
java.lang.Class r1 = r5.getClass()
Lf:
java.lang.Class<java.lang.Object> r2 = java.lang.Object.class
boolean r2 = o.C14957gcv.b(r1, r2)
r3 = 0
if (r2 != 0) goto L38
java.lang.reflect.Field r2 = r1.getDeclaredField(r7) // Catch: java.lang.NoSuchFieldException -> L30
r4 = 1
r2.setAccessible(r4) // Catch: java.lang.NoSuchFieldException -> L30
java.lang.Object r2 = r2.get(r5) // Catch: java.lang.NoSuchFieldException -> L30
boolean r4 = r6.isInstance(r2) // Catch: java.lang.NoSuchFieldException -> L30
if (r4 != 0) goto L2b
goto L2f
L2b:
java.lang.Object r3 = r6.cast(r2) // Catch: java.lang.NoSuchFieldException -> L30
L2f:
return r3
L30:
java.lang.Class r1 = r1.getSuperclass()
o.C14957gcv.c(r1, r0)
goto Lf
L38:
java.lang.String r0 = "delegate"
boolean r1 = o.C14957gcv.b(r7, r0)
if (r1 != 0) goto L49
java.lang.Class<java.lang.Object> r1 = java.lang.Object.class
java.lang.Object r5 = readFieldOrNull(r5, r1, r0)
if (r5 == 0) goto L49
goto L0
L49:
return r3
*/
throw new UnsupportedOperationException("Method not decompiled: okhttp3.internal.Util.readFieldOrNull(java.lang.Object, java.lang.Class, java.lang.String):java.lang.Object");
}
public static final <E> void addIfAbsent(List<E> list, E e) {
C14957gcv.e(list, "");
if (list.contains(e)) {
return;
}
list.add(e);
}
public static final void assertThreadHoldsLock(Object obj) {
C14957gcv.e(obj, "");
if (!assertionsEnabled || Thread.holdsLock(obj)) {
return;
}
StringBuilder sb = new StringBuilder("Thread ");
sb.append((Object) Thread.currentThread().getName());
sb.append(" MUST hold lock on ");
sb.append(obj);
throw new AssertionError(sb.toString());
}
public static final void assertThreadDoesntHoldLock(Object obj) {
C14957gcv.e(obj, "");
if (assertionsEnabled && Thread.holdsLock(obj)) {
StringBuilder sb = new StringBuilder("Thread ");
sb.append((Object) Thread.currentThread().getName());
sb.append(" MUST NOT hold lock on ");
sb.append(obj);
throw new AssertionError(sb.toString());
}
}
public static final Throwable withSuppressed(Exception exc, List<? extends Exception> list) {
C14957gcv.e(exc, "");
C14957gcv.e(list, "");
if (list.size() > 1) {
System.out.println(list);
}
for (Exception exc2 : list) {
Exception exc3 = exc;
C14957gcv.e(exc3, "");
C14957gcv.e(exc2, "");
if (exc3 != exc2) {
C14887gbC.c.d(exc3, exc2);
}
}
return exc;
}
public static final int indexOf(String[] strArr, String str, Comparator<String> comparator) {
C14957gcv.e(strArr, "");
C14957gcv.e(str, "");
C14957gcv.e(comparator, "");
int length = strArr.length;
for (int i = 0; i < length; i++) {
if (comparator.compare(strArr[i], str) == 0) {
return i;
}
}
return -1;
}
public static final <T> List<T> filterList(Iterable<? extends T> iterable, InterfaceC14894gbR<? super T, Boolean> interfaceC14894gbR) {
C14957gcv.e(iterable, "");
C14957gcv.e(interfaceC14894gbR, "");
ArrayList arrayList = C14851gaI.c;
for (T t : iterable) {
if (interfaceC14894gbR.invoke(t).booleanValue()) {
if (arrayList.isEmpty()) {
arrayList = new ArrayList();
}
gcQ.b(arrayList).add(t);
}
}
return arrayList;
}
public static final int skipAll(C15111ghZ c15111ghZ, byte b) {
C14957gcv.e(c15111ghZ, "");
int i = 0;
while (c15111ghZ.c != 0 && c15111ghZ.d(0L) == b) {
i++;
c15111ghZ.f();
}
return i;
}
/* JADX INFO: Access modifiers changed from: private */
/* renamed from: asFactory$lambda-8, reason: not valid java name */
public static final EventListener m492asFactory$lambda8(EventListener eventListener, Call call) {
C14957gcv.e(eventListener, "");
C14957gcv.e(call, "");
return eventListener;
}
}