恐 怖 老 奶 奶1破 解 版 中 文 版 无 敌 版 v4.15.00版本的 MD5 值为:2c4218ea002b12a6cce81f33a9f0144d
以下内容为反编译后的 h.java 源代码,内容仅作参考
package com.kwad.sdk.core.videocache;
import android.text.TextUtils;
import com.kwad.sdk.core.network.q;
import com.kwad.sdk.core.network.s;
import com.kwad.sdk.utils.an;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InterruptedIOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Map;
public final class h implements l {
public final com.kwad.sdk.core.videocache.c.b amT;
public final com.kwad.sdk.core.videocache.a.b amU;
public m anp;
public HttpURLConnection anq;
public InputStream anr;
public h(h hVar) {
this.anp = hVar.anp;
this.amT = hVar.amT;
this.amU = hVar.amU;
}
public h(String str, com.kwad.sdk.core.videocache.c.b bVar, com.kwad.sdk.core.videocache.a.b bVar2) {
this.amT = (com.kwad.sdk.core.videocache.c.b) an.checkNotNull(bVar);
this.amU = (com.kwad.sdk.core.videocache.a.b) an.checkNotNull(bVar2);
m cI = bVar.cI(str);
this.anp = cI == null ? new m(str, -2147483648L, k.cG(str)) : cI;
}
private long a(HttpURLConnection httpURLConnection, long j, int i2) {
long c2 = c(httpURLConnection);
return i2 == 200 ? c2 : i2 == 206 ? c2 + j : this.anp.anE;
}
private void a(HttpURLConnection httpURLConnection, String str) {
for (Map.Entry<String, String> entry : this.amU.yX().entrySet()) {
httpURLConnection.setRequestProperty(entry.getKey(), entry.getValue());
}
}
private HttpURLConnection b(long j, int i2) {
String str;
HttpURLConnection httpURLConnection;
boolean z;
String str2 = this.anp.url;
int i3 = 0;
do {
StringBuilder sb = new StringBuilder("Open connection ");
int i4 = (j > 0L ? 1 : (j == 0L ? 0 : -1));
if (i4 > 0) {
str = " with offset " + j;
} else {
str = "";
}
sb.append(str);
sb.append(" to ");
sb.append(str2);
com.kwad.sdk.core.d.b.d("HttpUrlSource", sb.toString());
httpURLConnection = (HttpURLConnection) new URL(str2).openConnection();
s.wrapHttpURLConnection(httpURLConnection);
a(httpURLConnection, str2);
if (i4 > 0) {
httpURLConnection.setRequestProperty("Range", "bytes=" + j + "-");
}
if (i2 > 0) {
httpURLConnection.setConnectTimeout(i2);
httpURLConnection.setReadTimeout(i2);
}
q.b(httpURLConnection);
int responseCode = httpURLConnection.getResponseCode();
z = responseCode == 301 || responseCode == 302 || responseCode == 303;
if (z) {
str2 = httpURLConnection.getHeaderField("Location");
i3++;
httpURLConnection.disconnect();
}
if (i3 > 5) {
throw new ProxyCacheException("Too many redirects: " + i3);
}
} while (z);
return httpURLConnection;
}
public static long c(HttpURLConnection httpURLConnection) {
String headerField = httpURLConnection.getHeaderField("Content-Length");
if (headerField == null) {
return -1L;
}
return Long.parseLong(headerField);
}
private void yP() {
HttpURLConnection httpURLConnection;
com.kwad.sdk.core.d.b.d("HttpUrlSource", "Read content info from " + this.anp.url);
?? r0 = 10000;
InputStream inputStream = null;
try {
try {
httpURLConnection = b(0L, 10000);
try {
long c2 = c(httpURLConnection);
String contentType = httpURLConnection.getContentType();
inputStream = httpURLConnection.getInputStream();
m mVar = new m(this.anp.url, c2, contentType);
this.anp = mVar;
this.amT.a(mVar.url, mVar);
com.kwad.sdk.core.d.b.d("HttpUrlSource", "Source info fetched: " + this.anp);
r0 = httpURLConnection;
} catch (IOException unused) {
com.kwad.sdk.core.d.b.e("HttpUrlSource", "Error fetching info from " + this.anp.url);
r0 = httpURLConnection;
com.kwad.sdk.crash.utils.b.closeQuietly(inputStream);
com.kwad.sdk.crash.utils.b.a(r0);
}
} catch (Throwable th) {
th = th;
com.kwad.sdk.crash.utils.b.closeQuietly(inputStream);
com.kwad.sdk.crash.utils.b.a(r0);
throw th;
}
} catch (IOException unused2) {
httpURLConnection = null;
} catch (Throwable th2) {
th = th2;
r0 = 0;
com.kwad.sdk.crash.utils.b.closeQuietly(inputStream);
com.kwad.sdk.crash.utils.b.a(r0);
throw th;
}
com.kwad.sdk.crash.utils.b.closeQuietly(inputStream);
com.kwad.sdk.crash.utils.b.a(r0);
}
@Override
public final void U(long j) {
try {
HttpURLConnection b2 = b(j, -1);
this.anq = b2;
String contentType = b2.getContentType();
this.anr = new BufferedInputStream(this.anq.getInputStream(), 8192);
m mVar = new m(this.anp.url, a(this.anq, j, this.anq.getResponseCode()), contentType);
this.anp = mVar;
this.amT.a(mVar.url, mVar);
} catch (IOException e2) {
throw new ProxyCacheException("Error opening connection for " + this.anp.url + " with offset " + j, e2);
}
}
@Override
public final void close() {
HttpURLConnection httpURLConnection = this.anq;
if (httpURLConnection != null) {
try {
httpURLConnection.disconnect();
} catch (ArrayIndexOutOfBoundsException unused) {
com.kwad.sdk.core.d.b.e("HttpUrlSource", "Error closing connection correctly. Should happen only on Android L. If anybody know how to fix it, please visit https://github.com/danikula/AndroidVideoCache/issues/88. Until good solution is not know, just ignore this issue.");
} catch (IllegalArgumentException e2) {
e = e2;
throw new RuntimeException("Wait... but why? WTF!? Really shouldn't happen any more after fixing https://github.com/danikula/AndroidVideoCache/issues/43. If you read it on your device log, please, notify me danikula@gmail.com or create issue here https://github.com/danikula/AndroidVideoCache/issues.", e);
} catch (NullPointerException e3) {
e = e3;
throw new RuntimeException("Wait... but why? WTF!? Really shouldn't happen any more after fixing https://github.com/danikula/AndroidVideoCache/issues/43. If you read it on your device log, please, notify me danikula@gmail.com or create issue here https://github.com/danikula/AndroidVideoCache/issues.", e);
}
}
}
@Override
public final synchronized long length() {
if (this.anp.anE == -2147483648L) {
yP();
}
return this.anp.anE;
}
@Override
public final int read(byte[] bArr) {
InputStream inputStream = this.anr;
if (inputStream == null) {
throw new ProxyCacheException("Error reading data from " + this.anp.url + ": connection is absent!");
}
try {
return inputStream.read(bArr, 0, 8192);
} catch (InterruptedIOException e2) {
throw new InterruptedProxyCacheException("Reading source " + this.anp.url + " is interrupted", e2);
} catch (IOException e3) {
throw new ProxyCacheException("Error reading data from " + this.anp.url, e3);
}
}
public final String toString() {
return "HttpUrlSource{sourceInfo='" + this.anp + "}";
}
public final synchronized String yQ() {
if (TextUtils.isEmpty(this.anp.anF)) {
yP();
}
return this.anp.anF;
}
}