导航菜单

页面标题

页面副标题

Housing v14.7.8 - l.java 源代码

正在查看: Housing v14.7.8 应用的 l.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package u2;

import android.net.Uri;
import androidx.annotation.Nullable;
import androidx.compose.foundation.text.selection.v0;
import androidx.media3.common.PlaybackException;
import androidx.media3.common.util.Log;
import androidx.media3.common.util.UnstableApi;
import androidx.media3.common.util.h0;
import androidx.media3.datasource.DataSpec;
import androidx.media3.datasource.HttpDataSource$HttpDataSourceException;
import com.google.common.collect.e4;
import com.google.common.collect.j1;
import com.google.common.collect.z0;
import com.google.firebase.perf.network.FirebasePerfUrlConnection;
import java.io.IOException;
import java.io.InputStream;
import java.io.InterruptedIOException;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.NoRouteToHostException;
import java.net.URL;
import java.net.URLConnection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.zip.GZIPInputStream;
import u2.g;

public class l extends u2.b implements g {

    @UnstableApi
    public static final int DEFAULT_CONNECT_TIMEOUT_MILLIS = 8000;

    @UnstableApi
    public static final int DEFAULT_READ_TIMEOUT_MILLIS = 8000;
    private static final int HTTP_STATUS_PERMANENT_REDIRECT = 308;
    private static final int HTTP_STATUS_TEMPORARY_REDIRECT = 307;
    private static final int MAX_REDIRECTS = 20;
    private static final String TAG = "DefaultHttpDataSource";
    private final boolean allowCrossProtocolRedirects;
    private long bytesRead;
    private long bytesToRead;
    private final int connectTimeoutMillis;

    @Nullable
    private HttpURLConnection connection;

    @Nullable
    private final com.google.common.base.p<String> contentTypePredicate;
    private final boolean crossProtocolRedirectsForceOriginal;

    @Nullable
    private DataSpec dataSpec;

    @Nullable
    private final r defaultRequestProperties;

    @Nullable
    private InputStream inputStream;
    private final boolean keepPostFor302Redirects;
    private final int readTimeoutMillis;
    private final r requestProperties;
    private int responseCode;
    private boolean transferStarted;

    @Nullable
    private final String userAgent;

    public static final class a implements g.a {
        private boolean allowCrossProtocolRedirects;

        @Nullable
        private com.google.common.base.p<String> contentTypePredicate;
        private boolean crossProtocolRedirectsForceOriginal;
        private boolean keepPostFor302Redirects;

        @Nullable
        private y transferListener;

        @Nullable
        private String userAgent;
        private final r defaultRequestProperties = new r();
        private int connectTimeoutMs = 8000;
        private int readTimeoutMs = 8000;

        @Override
        public final l a() {
            l lVar = new l(this.userAgent, this.connectTimeoutMs, this.readTimeoutMs, this.allowCrossProtocolRedirects, this.crossProtocolRedirectsForceOriginal, this.defaultRequestProperties, this.contentTypePredicate, this.keepPostFor302Redirects);
            y yVar = this.transferListener;
            if (yVar != null) {
                lVar.l(yVar);
            }
            return lVar;
        }

        public final void c(boolean z4) {
            this.allowCrossProtocolRedirects = z4;
        }

        public final void d(int i5) {
            this.connectTimeoutMs = i5;
        }

        public final void e(int i5) {
            this.readTimeoutMs = i5;
        }

        public final void f(String str) {
            this.userAgent = str;
        }
    }

    public static class b extends z0<String, List<String>> {
        private final Map<String, List<String>> headers;

        public b(Map<String, List<String>> map) {
            this.headers = map;
        }

        public final boolean containsKey(Object obj) {
            return obj != null && super.containsKey(obj);
        }

        public final boolean containsValue(Object obj) {
            return super.standardContainsValue(obj);
        }

        public final Object delegate() {
            return this.headers;
        }

        public final Set entrySet() {
            return e4.b(super.entrySet(), new m(0));
        }

        public final boolean equals(Object obj) {
            return obj != null && super.standardEquals(obj);
        }

        public final Object get(Object obj) {
            if (obj == null) {
                return null;
            }
            return (List) super.get(obj);
        }

        public final int hashCode() {
            return super.standardHashCode();
        }

        public final boolean isEmpty() {
            return super.isEmpty() || (super.size() == 1 && super.containsKey((Object) null));
        }

        public final Set keySet() {
            return e4.b(super.keySet(), new m(1));
        }

        public final int size() {
            return super.size() - (super.containsKey((Object) null) ? 1 : 0);
        }

        public final Map m575delegate() {
            return this.headers;
        }
    }

    public l(String str, int i5, int i6, boolean z4, boolean z5, r rVar, com.google.common.base.p pVar, boolean z6) {
        super(true);
        this.userAgent = str;
        this.connectTimeoutMillis = i5;
        this.readTimeoutMillis = i6;
        this.allowCrossProtocolRedirects = z4;
        this.crossProtocolRedirectsForceOriginal = z5;
        if (z4 && z5) {
            throw new IllegalArgumentException("crossProtocolRedirectsForceOriginal should not be set if allowCrossProtocolRedirects is true");
        }
        this.defaultRequestProperties = rVar;
        this.contentTypePredicate = pVar;
        this.requestProperties = new r();
        this.keepPostFor302Redirects = z6;
    }

    @Override
    public final void close() {
        try {
            InputStream inputStream = this.inputStream;
            if (inputStream != null) {
                try {
                    inputStream.close();
                } catch (IOException e5) {
                    DataSpec dataSpec = this.dataSpec;
                    int i5 = h0.SDK_INT;
                    throw new HttpDataSource$HttpDataSourceException(e5, dataSpec, 2000, 3);
                }
            }
        } finally {
            this.inputStream = null;
            q();
            if (this.transferStarted) {
                this.transferStarted = false;
                n();
            }
            this.connection = null;
            this.dataSpec = null;
        }
    }

    @Override
    public final Map getResponseHeaders() {
        HttpURLConnection httpURLConnection = this.connection;
        return httpURLConnection == null ? j1.of() : new b(httpURLConnection.getHeaderFields());
    }

    @Override
    public final Uri getUri() {
        HttpURLConnection httpURLConnection = this.connection;
        if (httpURLConnection != null) {
            return Uri.parse(httpURLConnection.getURL().toString());
        }
        DataSpec dataSpec = this.dataSpec;
        if (dataSpec != null) {
            return dataSpec.uri;
        }
        return null;
    }

    @Override
    public final long j(DataSpec dataSpec) {
        byte[] bArr;
        this.dataSpec = dataSpec;
        long j5 = 0;
        this.bytesRead = 0L;
        this.bytesToRead = 0L;
        o();
        try {
            HttpURLConnection s4 = s(dataSpec);
            this.connection = s4;
            this.responseCode = s4.getResponseCode();
            String responseMessage = s4.getResponseMessage();
            int i5 = this.responseCode;
            if (i5 < 200 || i5 > 299) {
                Map<String, List<String>> headerFields = s4.getHeaderFields();
                if (this.responseCode == 416) {
                    if (dataSpec.position == s.b(s4.getHeaderField("Content-Range"))) {
                        this.transferStarted = true;
                        p(dataSpec);
                        long j6 = dataSpec.length;
                        if (j6 != -1) {
                            return j6;
                        }
                        return 0L;
                    }
                }
                InputStream errorStream = s4.getErrorStream();
                try {
                    bArr = errorStream != null ? com.google.common.io.a.b(errorStream) : h0.EMPTY_BYTE_ARRAY;
                } catch (IOException unused) {
                    bArr = h0.EMPTY_BYTE_ARRAY;
                }
                byte[] bArr2 = bArr;
                q();
                throw new q(this.responseCode, responseMessage, this.responseCode == 416 ? new h(2008) : null, headerFields, dataSpec, bArr2);
            }
            String contentType = s4.getContentType();
            com.google.common.base.p<String> pVar = this.contentTypePredicate;
            if (pVar != null && !pVar.apply(contentType)) {
                q();
                throw new p(contentType, dataSpec);
            }
            if (this.responseCode == 200) {
                long j7 = dataSpec.position;
                if (j7 != 0) {
                    j5 = j7;
                }
            }
            boolean equalsIgnoreCase = "gzip".equalsIgnoreCase(s4.getHeaderField("Content-Encoding"));
            if (equalsIgnoreCase) {
                this.bytesToRead = dataSpec.length;
            } else {
                long j8 = dataSpec.length;
                if (j8 != -1) {
                    this.bytesToRead = j8;
                } else {
                    long a5 = s.a(s4.getHeaderField("Content-Length"), s4.getHeaderField("Content-Range"));
                    this.bytesToRead = a5 != -1 ? a5 - j5 : -1L;
                }
            }
            try {
                this.inputStream = s4.getInputStream();
                if (equalsIgnoreCase) {
                    this.inputStream = new GZIPInputStream(this.inputStream);
                }
                this.transferStarted = true;
                p(dataSpec);
                try {
                    u(j5, dataSpec);
                    return this.bytesToRead;
                } catch (IOException e5) {
                    q();
                    if (e5 instanceof HttpDataSource$HttpDataSourceException) {
                        throw ((HttpDataSource$HttpDataSourceException) e5);
                    }
                    throw new HttpDataSource$HttpDataSourceException(e5, dataSpec, 2000, 1);
                }
            } catch (IOException e6) {
                q();
                throw new HttpDataSource$HttpDataSourceException(e6, dataSpec, 2000, 1);
            }
        } catch (IOException e7) {
            q();
            throw HttpDataSource$HttpDataSourceException.createForIOException(e7, dataSpec, 1);
        }
    }

    public final void q() {
        HttpURLConnection httpURLConnection = this.connection;
        if (httpURLConnection != null) {
            try {
                httpURLConnection.disconnect();
            } catch (Exception e5) {
                Log.d(TAG, "Unexpected error while disconnecting", e5);
            }
        }
    }

    public final URL r(URL url, String str, DataSpec dataSpec) {
        if (str == null) {
            throw new HttpDataSource$HttpDataSourceException("Null location redirect", dataSpec, PlaybackException.ERROR_CODE_IO_NETWORK_CONNECTION_FAILED, 1);
        }
        try {
            URL url2 = new URL(url, str);
            String protocol = url2.getProtocol();
            if (!"https".equals(protocol) && !"http".equals(protocol)) {
                throw new HttpDataSource$HttpDataSourceException(defpackage.a.l("Unsupported protocol redirect: ", protocol), dataSpec, PlaybackException.ERROR_CODE_IO_NETWORK_CONNECTION_FAILED, 1);
            }
            if (this.allowCrossProtocolRedirects || protocol.equals(url.getProtocol())) {
                return url2;
            }
            if (this.crossProtocolRedirectsForceOriginal) {
                try {
                    return new URL(url2.toString().replaceFirst(protocol, url.getProtocol()));
                } catch (MalformedURLException e5) {
                    throw new HttpDataSource$HttpDataSourceException(e5, dataSpec, PlaybackException.ERROR_CODE_IO_NETWORK_CONNECTION_FAILED, 1);
                }
            }
            throw new HttpDataSource$HttpDataSourceException("Disallowed cross-protocol redirect (" + url.getProtocol() + " to " + protocol + ")", dataSpec, PlaybackException.ERROR_CODE_IO_NETWORK_CONNECTION_FAILED, 1);
        } catch (MalformedURLException e6) {
            throw new HttpDataSource$HttpDataSourceException(e6, dataSpec, PlaybackException.ERROR_CODE_IO_NETWORK_CONNECTION_FAILED, 1);
        }
    }

    @Override
    public final int read(byte[] bArr, int i5, int i6) {
        if (i6 == 0) {
            return 0;
        }
        try {
            long j5 = this.bytesToRead;
            if (j5 != -1) {
                long j6 = j5 - this.bytesRead;
                if (j6 == 0) {
                    return -1;
                }
                i6 = (int) Math.min(i6, j6);
            }
            InputStream inputStream = this.inputStream;
            int i7 = h0.SDK_INT;
            int read = inputStream.read(bArr, i5, i6);
            if (read != -1) {
                this.bytesRead += read;
                m(read);
                return read;
            }
            return -1;
        } catch (IOException e5) {
            DataSpec dataSpec = this.dataSpec;
            int i8 = h0.SDK_INT;
            throw HttpDataSource$HttpDataSourceException.createForIOException(e5, dataSpec, 2);
        }
    }

    public final HttpURLConnection s(DataSpec dataSpec) {
        HttpURLConnection t4;
        URL url = new URL(dataSpec.uri.toString());
        int i5 = dataSpec.httpMethod;
        byte[] bArr = dataSpec.httpBody;
        long j5 = dataSpec.position;
        long j6 = dataSpec.length;
        int i6 = 1;
        int i7 = 0;
        boolean z4 = (dataSpec.flags & 1) == 1;
        if (!this.allowCrossProtocolRedirects && !this.crossProtocolRedirectsForceOriginal && !this.keepPostFor302Redirects) {
            return t(url, i5, bArr, j5, j6, z4, true, dataSpec.httpRequestHeaders);
        }
        while (true) {
            int i8 = i7 + 1;
            if (i7 > 20) {
                throw new HttpDataSource$HttpDataSourceException(new NoRouteToHostException(defpackage.a.g(i8, "Too many redirects: ")), dataSpec, PlaybackException.ERROR_CODE_IO_NETWORK_CONNECTION_FAILED, 1);
            }
            t4 = t(url, i5, bArr, j5, j6, z4, false, dataSpec.httpRequestHeaders);
            int responseCode = t4.getResponseCode();
            String headerField = t4.getHeaderField("Location");
            if ((i5 == i6 || i5 == 3) && (responseCode == 300 || responseCode == 301 || responseCode == 302 || responseCode == 303 || responseCode == HTTP_STATUS_TEMPORARY_REDIRECT || responseCode == HTTP_STATUS_PERMANENT_REDIRECT)) {
                t4.disconnect();
                url = r(url, headerField, dataSpec);
            } else {
                if (i5 != 2 || (responseCode != 300 && responseCode != 301 && responseCode != 302 && responseCode != 303)) {
                    break;
                }
                t4.disconnect();
                if (!this.keepPostFor302Redirects || responseCode != 302) {
                    bArr = null;
                    i5 = 1;
                }
                url = r(url, headerField, dataSpec);
            }
            i7 = i8;
            i6 = 1;
        }
        return t4;
    }

    public final HttpURLConnection t(URL url, int i5, byte[] bArr, long j5, long j6, boolean z4, boolean z5, Map map) {
        String sb;
        String str;
        HttpURLConnection httpURLConnection = (HttpURLConnection) ((URLConnection) FirebasePerfUrlConnection.instrument(url.openConnection()));
        httpURLConnection.setConnectTimeout(this.connectTimeoutMillis);
        httpURLConnection.setReadTimeout(this.readTimeoutMillis);
        HashMap hashMap = new HashMap();
        r rVar = this.defaultRequestProperties;
        if (rVar != null) {
            hashMap.putAll(rVar.a());
        }
        hashMap.putAll(this.requestProperties.a());
        hashMap.putAll(map);
        for (Map.Entry entry : hashMap.entrySet()) {
            httpURLConnection.setRequestProperty((String) entry.getKey(), (String) entry.getValue());
        }
        int i6 = s.f1162a;
        if (j5 == 0 && j6 == -1) {
            sb = null;
        } else {
            StringBuilder t4 = v0.t("bytes=", j5, "-");
            if (j6 != -1) {
                t4.append((j5 + j6) - 1);
            }
            sb = t4.toString();
        }
        if (sb != null) {
            httpURLConnection.setRequestProperty("Range", sb);
        }
        String str2 = this.userAgent;
        if (str2 != null) {
            httpURLConnection.setRequestProperty("User-Agent", str2);
        }
        httpURLConnection.setRequestProperty("Accept-Encoding", z4 ? "gzip" : "identity");
        httpURLConnection.setInstanceFollowRedirects(z5);
        httpURLConnection.setDoOutput(bArr != null);
        int i7 = DataSpec.FLAG_ALLOW_GZIP;
        if (i5 == 1) {
            str = "GET";
        } else if (i5 == 2) {
            str = "POST";
        } else {
            if (i5 != 3) {
                throw new IllegalStateException();
            }
            str = "HEAD";
        }
        httpURLConnection.setRequestMethod(str);
        if (bArr == null) {
            httpURLConnection.connect();
            return httpURLConnection;
        }
        httpURLConnection.setFixedLengthStreamingMode(bArr.length);
        httpURLConnection.connect();
        OutputStream outputStream = httpURLConnection.getOutputStream();
        outputStream.write(bArr);
        outputStream.close();
        return httpURLConnection;
    }

    public final void u(long j5, DataSpec dataSpec) {
        if (j5 == 0) {
            return;
        }
        byte[] bArr = new byte[4096];
        while (j5 > 0) {
            int min = (int) Math.min(j5, 4096);
            InputStream inputStream = this.inputStream;
            int i5 = h0.SDK_INT;
            int read = inputStream.read(bArr, 0, min);
            if (Thread.currentThread().isInterrupted()) {
                throw new HttpDataSource$HttpDataSourceException(new InterruptedIOException(), dataSpec, 2000, 1);
            }
            if (read == -1) {
                throw new HttpDataSource$HttpDataSourceException(dataSpec, 2008, 1);
            }
            j5 -= read;
            m(read);
        }
    }
}