JieJing Cleaner v1.4.2版本的 MD5 值为:a574eea9fb07160f0bbb08ba0adf1c62
以下内容为反编译后的 h.java 源代码,内容仅作参考
package com.kwad.sdk.core.videocache;
import android.text.TextUtils;
import com.kwad.sdk.api.core.RequestParamsUtils;
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;
import l1L1L1L1L1l1LLL1LL1ll.lilil1liLi1lLL1l1l.Ll1lLl1l1LL1l1Ll.Ll1lLl1l1LL1l1Ll.Ll1lLl1l1LL1l1Ll;
public class h implements m {
public final com.kwad.sdk.core.videocache.c.b a;
public final com.kwad.sdk.core.videocache.a.b b;
public n c;
public HttpURLConnection d;
public InputStream e;
public h(h hVar) {
this.c = hVar.c;
this.a = hVar.a;
this.b = hVar.b;
}
public h(String str, com.kwad.sdk.core.videocache.c.b bVar, com.kwad.sdk.core.videocache.a.b bVar2) {
this.a = (com.kwad.sdk.core.videocache.c.b) j.a(bVar);
this.b = (com.kwad.sdk.core.videocache.a.b) j.a(bVar2);
n a = bVar.a(str);
this.c = a == null ? new n(str, -2147483648L, l.a(str)) : a;
}
private long a(HttpURLConnection httpURLConnection) {
String headerField = httpURLConnection.getHeaderField("Content-Length");
if (headerField == null) {
return -1L;
}
return Long.parseLong(headerField);
}
private long a(HttpURLConnection httpURLConnection, long j, int i2) {
long a = a(httpURLConnection);
return i2 == 200 ? a : i2 == 206 ? a + j : this.c.b;
}
private HttpURLConnection a(long j, int i2) {
HttpURLConnection httpURLConnection;
boolean z;
String str = this.c.a;
int i3 = 0;
do {
StringBuilder Ll1lLl1l1LL1l1Ll2 = Ll1lLl1l1LL1l1Ll.Ll1lLl1l1LL1l1Ll("Open connection ");
Ll1lLl1l1LL1l1Ll2.append(j > 0 ? Ll1lLl1l1LL1l1Ll.Ll1lLl1l1LL1l1Ll(" with offset ", j) : "");
Ll1lLl1l1LL1l1Ll2.append(" to ");
Ll1lLl1l1LL1l1Ll2.append(str);
com.kwad.sdk.core.d.a.a("HttpUrlSource", Ll1lLl1l1LL1l1Ll2.toString());
httpURLConnection = (HttpURLConnection) new URL(str).openConnection();
com.kwad.sdk.core.network.m.a(httpURLConnection);
a(httpURLConnection, str);
if (j > 0) {
httpURLConnection.setRequestProperty("Range", "bytes=" + j + "-");
}
if (i2 > 0) {
httpURLConnection.setConnectTimeout(i2);
httpURLConnection.setReadTimeout(i2);
}
httpURLConnection.setRequestProperty(RequestParamsUtils.USER_AGENT_KEY, com.kwad.sdk.core.network.k.a());
int responseCode = httpURLConnection.getResponseCode();
z = responseCode == 301 || responseCode == 302 || responseCode == 303;
if (z) {
str = httpURLConnection.getHeaderField("Location");
i3++;
httpURLConnection.disconnect();
}
if (i3 > 5) {
throw new ProxyCacheException(Ll1lLl1l1LL1l1Ll.Ll1lLl1l1LL1l1Ll("Too many redirects: ", i3));
}
} while (z);
return httpURLConnection;
}
private void a(HttpURLConnection httpURLConnection, String str) {
for (Map.Entry<String, String> entry : this.b.a(str).entrySet()) {
httpURLConnection.setRequestProperty(entry.getKey(), entry.getValue());
}
}
private void e() {
HttpURLConnection httpURLConnection;
HttpURLConnection httpURLConnection2;
StringBuilder Ll1lLl1l1LL1l1Ll2 = Ll1lLl1l1LL1l1Ll.Ll1lLl1l1LL1l1Ll("Read content info from ");
Ll1lLl1l1LL1l1Ll2.append(this.c.a);
com.kwad.sdk.core.d.a.a("HttpUrlSource", Ll1lLl1l1LL1l1Ll2.toString());
?? r0 = 10000;
InputStream inputStream = null;
try {
try {
httpURLConnection2 = a(0L, 10000);
try {
long a = a(httpURLConnection2);
String contentType = httpURLConnection2.getContentType();
inputStream = httpURLConnection2.getInputStream();
n nVar = new n(this.c.a, a, contentType);
this.c = nVar;
this.a.a(nVar.a, nVar);
com.kwad.sdk.core.d.a.a("HttpUrlSource", "Source info fetched: " + this.c);
l.a(inputStream);
r0 = httpURLConnection2;
} catch (IOException unused) {
com.kwad.sdk.core.d.a.e("HttpUrlSource", "Error fetching info from " + this.c.a);
l.a(inputStream);
r0 = httpURLConnection2;
if (httpURLConnection2 == null) {
return;
}
r0.disconnect();
}
} catch (Throwable th) {
InputStream inputStream2 = inputStream;
HttpURLConnection httpURLConnection3 = r0;
inputStream = inputStream2;
th = th;
httpURLConnection = httpURLConnection3;
l.a(inputStream);
if (httpURLConnection != null) {
httpURLConnection.disconnect();
}
throw th;
}
} catch (IOException unused2) {
httpURLConnection2 = null;
} catch (Throwable th2) {
th = th2;
httpURLConnection = null;
l.a(inputStream);
if (httpURLConnection != null) {
}
throw th;
}
r0.disconnect();
}
@Override
public int a(byte[] bArr) {
InputStream inputStream = this.e;
if (inputStream != null) {
try {
return inputStream.read(bArr, 0, bArr.length);
} catch (InterruptedIOException e) {
throw new InterruptedProxyCacheException(Ll1lLl1l1LL1l1Ll.Ll1lLl1l1LL1l1Ll(Ll1lLl1l1LL1l1Ll.Ll1lLl1l1LL1l1Ll("Reading source "), this.c.a, " is interrupted"), e);
} catch (IOException e2) {
StringBuilder Ll1lLl1l1LL1l1Ll2 = Ll1lLl1l1LL1l1Ll.Ll1lLl1l1LL1l1Ll("Error reading data from ");
Ll1lLl1l1LL1l1Ll2.append(this.c.a);
throw new ProxyCacheException(Ll1lLl1l1LL1l1Ll2.toString(), e2);
}
}
throw new ProxyCacheException(Ll1lLl1l1LL1l1Ll.Ll1lLl1l1LL1l1Ll(Ll1lLl1l1LL1l1Ll.Ll1lLl1l1LL1l1Ll("Error reading data from "), this.c.a, ": connection is absent!"));
}
@Override
public synchronized long a() {
if (this.c.b == -2147483648L) {
e();
}
return this.c.b;
}
@Override
public void a(long j) {
try {
HttpURLConnection a = a(j, -1);
this.d = a;
String contentType = a.getContentType();
this.e = new BufferedInputStream(this.d.getInputStream(), 8192);
n nVar = new n(this.c.a, a(this.d, j, this.d.getResponseCode()), contentType);
this.c = nVar;
this.a.a(nVar.a, nVar);
} catch (IOException e) {
StringBuilder Ll1lLl1l1LL1l1Ll2 = Ll1lLl1l1LL1l1Ll.Ll1lLl1l1LL1l1Ll("Error opening connection for ");
Ll1lLl1l1LL1l1Ll2.append(this.c.a);
Ll1lLl1l1LL1l1Ll2.append(" with offset ");
Ll1lLl1l1LL1l1Ll2.append(j);
throw new ProxyCacheException(Ll1lLl1l1LL1l1Ll2.toString(), e);
}
}
@Override
public void b() {
HttpURLConnection httpURLConnection = this.d;
if (httpURLConnection != null) {
try {
httpURLConnection.disconnect();
} catch (ArrayIndexOutOfBoundsException unused) {
com.kwad.sdk.core.d.a.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 e) {
e = e;
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 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);
}
}
}
public synchronized String c() {
if (TextUtils.isEmpty(this.c.c)) {
e();
}
return this.c.c;
}
public String d() {
return this.c.a;
}
public String toString() {
StringBuilder Ll1lLl1l1LL1l1Ll2 = Ll1lLl1l1LL1l1Ll.Ll1lLl1l1LL1l1Ll("HttpUrlSource{sourceInfo='");
Ll1lLl1l1LL1l1Ll2.append(this.c);
Ll1lLl1l1LL1l1Ll2.append("}");
return Ll1lLl1l1LL1l1Ll2.toString();
}
}