what-the-bank/sources/com/google/android/gms/internal/firebase_ml/zzfy.java

113 lines
3.6 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package com.google.android.gms.internal.firebase_ml;
import com.google.common.net.HttpHeaders;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/* loaded from: classes2.dex */
final class zzfy extends zzfq {
private final int responseCode;
private final String responseMessage;
private final HttpURLConnection zzvy;
private final ArrayList<String> zzvz;
private final ArrayList<String> zzwa;
/* JADX INFO: Access modifiers changed from: package-private */
public zzfy(HttpURLConnection httpURLConnection) throws IOException {
ArrayList<String> arrayList = new ArrayList<>();
this.zzvz = arrayList;
ArrayList<String> arrayList2 = new ArrayList<>();
this.zzwa = arrayList2;
this.zzvy = httpURLConnection;
int responseCode = httpURLConnection.getResponseCode();
this.responseCode = responseCode == -1 ? 0 : responseCode;
this.responseMessage = httpURLConnection.getResponseMessage();
for (Map.Entry<String, List<String>> entry : httpURLConnection.getHeaderFields().entrySet()) {
String key = entry.getKey();
if (key != null) {
for (String str : entry.getValue()) {
if (str != null) {
arrayList.add(key);
arrayList2.add(str);
}
}
}
}
}
@Override // com.google.android.gms.internal.firebase_ml.zzfq
public final InputStream getContent() throws IOException {
InputStream errorStream;
try {
errorStream = this.zzvy.getInputStream();
} catch (IOException unused) {
errorStream = this.zzvy.getErrorStream();
}
if (errorStream == null) {
return null;
}
return new zzfz(this, errorStream);
}
@Override // com.google.android.gms.internal.firebase_ml.zzfq
public final String getContentEncoding() {
return this.zzvy.getContentEncoding();
}
public final long getContentLength() {
String headerField = this.zzvy.getHeaderField(HttpHeaders.CONTENT_LENGTH);
if (headerField == null) {
return -1L;
}
return Long.parseLong(headerField);
}
@Override // com.google.android.gms.internal.firebase_ml.zzfq
public final String getContentType() {
return this.zzvy.getHeaderField(HttpHeaders.CONTENT_TYPE);
}
@Override // com.google.android.gms.internal.firebase_ml.zzfq
public final String zzfp() {
String headerField = this.zzvy.getHeaderField(0);
if (headerField == null || !headerField.startsWith("HTTP/1.")) {
return null;
}
return headerField;
}
@Override // com.google.android.gms.internal.firebase_ml.zzfq
public final int zzfq() {
return this.zzvz.size();
}
@Override // com.google.android.gms.internal.firebase_ml.zzfq
public final String zzab(int i) {
return this.zzvz.get(i);
}
@Override // com.google.android.gms.internal.firebase_ml.zzfq
public final String zzac(int i) {
return this.zzwa.get(i);
}
@Override // com.google.android.gms.internal.firebase_ml.zzfq
public final void disconnect() {
this.zzvy.disconnect();
}
@Override // com.google.android.gms.internal.firebase_ml.zzfq
public final int getStatusCode() {
return this.responseCode;
}
@Override // com.google.android.gms.internal.firebase_ml.zzfq
public final String getReasonPhrase() {
return this.responseMessage;
}
}