鳯华 v4.0.0版本的 MD5 值为:e66eea5d0a772ef117f7e252dfbb1dfc
以下内容为反编译后的 h.java 源代码,内容仅作参考
package l5;
import android.content.Context;
import android.os.Handler;
import com.tencent.open.SocialConstants;
import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.nio.charset.Charset;
import java.security.MessageDigest;
import java.util.Arrays;
import java.util.Objects;
import java.util.zip.Inflater;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import org.json.JSONObject;
public final class h {
private a f16690a;
private final Context f16691b;
public static class a {
public static final class RunnableC0190a implements Runnable {
final URL f16692a;
final x7.l f16693b;
final x7.l f16694c;
RunnableC0190a(URL url, x7.l lVar, x7.l lVar2) {
this.f16692a = url;
this.f16693b = lVar;
this.f16694c = lVar2;
}
@Override
public final void run() {
try {
URLConnection openConnection = this.f16692a.openConnection();
if (!(openConnection instanceof HttpURLConnection)) {
openConnection = null;
}
HttpURLConnection httpURLConnection = (HttpURLConnection) openConnection;
if (httpURLConnection == null) {
return;
}
httpURLConnection.setConnectTimeout(20000);
httpURLConnection.setRequestMethod("GET");
httpURLConnection.connect();
InputStream inputStream = httpURLConnection.getInputStream();
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
byte[] bArr = new byte[4096];
while (true) {
int read = inputStream.read(bArr, 0, 4096);
if (read == -1) {
this.f16693b.invoke(new ByteArrayInputStream(byteArrayOutputStream.toByteArray()));
n7.l lVar = n7.l.f17133a;
return;
}
byteArrayOutputStream.write(bArr, 0, read);
}
} catch (Exception e9) {
e9.printStackTrace();
this.f16694c.invoke(e9);
}
}
}
public void a(URL url, x7.l<? super InputStream, n7.l> lVar, x7.l<? super Exception, n7.l> lVar2) {
y7.g.f(url, SocialConstants.PARAM_URL);
y7.g.f(lVar, "complete");
y7.g.f(lVar2, "failure");
new Thread(new RunnableC0190a(url, lVar, lVar2)).start();
}
}
public interface b {
void a(n nVar);
void onError();
}
public static final class c implements Runnable {
final n f16695a;
final h f16696b;
final b f16697c;
c(n nVar, h hVar, b bVar) {
this.f16695a = nVar;
this.f16696b = hVar;
this.f16697c = bVar;
}
@Override
public final void run() {
this.f16697c.a(this.f16695a);
}
}
public static final class d extends y7.h implements x7.l<InputStream, n7.l> {
final URL f16699b;
final b f16700c;
public static final class a implements Runnable {
final n f16702b;
a(n nVar) {
this.f16702b = nVar;
}
@Override
public final void run() {
d.this.f16700c.a(this.f16702b);
}
}
public static final class b implements Runnable {
b() {
}
@Override
public final void run() {
d.this.f16700c.onError();
}
}
d(URL url, b bVar) {
super(1);
this.f16699b = url;
this.f16700c = bVar;
}
public final void b(InputStream inputStream) {
y7.g.f(inputStream, "it");
h hVar = h.this;
n h9 = hVar.h(inputStream, hVar.f(this.f16699b));
if (h9 != null) {
new Handler(h.this.f16691b.getMainLooper()).post(new a(h9));
return;
}
Boolean valueOf = Boolean.valueOf(new Handler(h.this.f16691b.getMainLooper()).post(new b()));
if (!(valueOf instanceof n7.l)) {
valueOf = null;
}
if (((n7.l) valueOf) != null) {
return;
}
n7.l lVar = n7.l.f17133a;
}
@Override
public n7.l invoke(InputStream inputStream) {
b(inputStream);
return n7.l.f17133a;
}
}
public static final class e extends y7.h implements x7.l<Exception, n7.l> {
final b f16705b;
public static final class a implements Runnable {
a() {
}
@Override
public final void run() {
e.this.f16705b.onError();
}
}
e(b bVar) {
super(1);
this.f16705b = bVar;
}
public final void b(Exception exc) {
y7.g.f(exc, "it");
new Handler(h.this.f16691b.getMainLooper()).post(new a());
}
@Override
public n7.l invoke(Exception exc) {
b(exc);
return n7.l.f17133a;
}
}
public static final class f implements Runnable {
final InputStream f16708b;
final String f16709c;
final b f16710d;
static final class a implements Runnable {
final n f16712b;
static final class RunnableC0191a implements Runnable {
RunnableC0191a() {
}
@Override
public final void run() {
a aVar = a.this;
f.this.f16710d.a(aVar.f16712b);
}
}
static final class b implements Runnable {
b() {
}
@Override
public final void run() {
f.this.f16710d.onError();
}
}
a(n nVar) {
this.f16712b = nVar;
}
@Override
public final void run() {
if (this.f16712b != null) {
new Handler(h.this.f16691b.getMainLooper()).post(new RunnableC0191a());
} else {
new Handler(h.this.f16691b.getMainLooper()).post(new b());
}
}
}
f(InputStream inputStream, String str, b bVar) {
this.f16708b = inputStream;
this.f16709c = str;
this.f16710d = bVar;
}
@Override
public final void run() {
new Thread(new a(h.this.h(this.f16708b, this.f16709c))).start();
}
}
public h(Context context) {
y7.g.f(context, "context");
this.f16691b = context;
this.f16690a = new a();
}
private final File d(String str) {
return new File(this.f16691b.getCacheDir().getAbsolutePath() + "/" + str + "/");
}
private final String e(String str) {
MessageDigest messageDigest = MessageDigest.getInstance("MD5");
Charset forName = Charset.forName("UTF-8");
y7.g.b(forName, "Charset.forName(charsetName)");
if (str != null) {
byte[] bytes = str.getBytes(forName);
y7.g.b(bytes, "(this as java.lang.String).getBytes(charset)");
messageDigest.update(bytes);
byte[] digest = messageDigest.digest();
StringBuffer stringBuffer = new StringBuffer();
for (byte b10 : digest) {
y7.r rVar = y7.r.f20583a;
String format = String.format("%02x", Arrays.copyOf(new Object[]{Byte.valueOf(b10)}, 1));
y7.g.b(format, "java.lang.String.format(format, *args)");
stringBuffer.append(format);
}
String stringBuffer2 = stringBuffer.toString();
y7.g.b(stringBuffer2, "sb.toString()");
return stringBuffer2;
}
throw new n7.j("null cannot be cast to non-null type java.lang.String");
}
public final String f(URL url) {
String url2 = url.toString();
y7.g.b(url2, "url.toString()");
return e(url2);
}
private final byte[] g(byte[] bArr) {
try {
Inflater inflater = new Inflater();
inflater.setInput(bArr, 0, bArr.length);
byte[] bArr2 = new byte[2048];
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
while (true) {
int inflate = inflater.inflate(bArr2, 0, 2048);
if (inflate <= 0) {
return byteArrayOutputStream.toByteArray();
}
byteArrayOutputStream.write(bArr2, 0, inflate);
}
} catch (Exception e9) {
e9.printStackTrace();
return null;
}
}
public final n h(InputStream inputStream, String str) {
int i9;
byte[] m9 = m(inputStream);
if (m9.length > 4 && m9[0] == 80 && m9[1] == 75 && m9[2] == 3 && m9[3] == 4) {
i9 = i.f16715a;
synchronized (Integer.valueOf(i9)) {
if (!d(str).exists()) {
try {
n(new ByteArrayInputStream(m9), str);
} catch (Exception e9) {
e9.printStackTrace();
}
}
n7.l lVar = n7.l.f17133a;
}
try {
File file = new File(this.f16691b.getCacheDir().getAbsolutePath() + "/" + str + "/");
File file2 = new File(file, "movie.binary");
if (!file2.isFile()) {
file2 = null;
}
if (file2 != null) {
try {
FileInputStream fileInputStream = new FileInputStream(file2);
m5.c c10 = m5.c.f16897i.c(fileInputStream);
y7.g.b(c10, "MovieEntity.ADAPTER.decode(it)");
n nVar = new n(c10, file);
fileInputStream.close();
return nVar;
} catch (Exception e10) {
file.delete();
file2.delete();
throw e10;
}
}
File file3 = new File(file, "movie.spec");
if (!file3.isFile()) {
file3 = null;
}
if (file3 != null) {
try {
FileInputStream fileInputStream2 = new FileInputStream(file3);
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
byte[] bArr = new byte[2048];
while (true) {
int read = fileInputStream2.read(bArr, 0, 2048);
if (read == -1) {
String byteArrayOutputStream2 = byteArrayOutputStream.toString();
Objects.requireNonNull(byteArrayOutputStream2);
JSONObject jSONObject = new JSONObject(byteArrayOutputStream2);
fileInputStream2.close();
return new n(jSONObject, file);
}
byteArrayOutputStream.write(bArr, 0, read);
}
} catch (Exception e11) {
file.delete();
file3.delete();
throw e11;
}
}
} catch (Exception e12) {
e12.printStackTrace();
}
e12.printStackTrace();
} else {
try {
byte[] g9 = g(m9);
if (g9 != null) {
m5.c f9 = m5.c.f16897i.f(g9);
y7.g.b(f9, "MovieEntity.ADAPTER.decode(it)");
return new n(f9, new File(str));
}
} catch (Exception e13) {
e13.printStackTrace();
}
}
return null;
}
private final n l(String str) {
File file;
File file2;
try {
file = new File(this.f16691b.getCacheDir().getAbsolutePath() + "/" + str + "/");
file2 = new File(file, "movie.binary");
if (!file2.isFile()) {
file2 = null;
}
} catch (Exception e9) {
e9.printStackTrace();
}
if (file2 != null) {
try {
FileInputStream fileInputStream = new FileInputStream(file2);
m5.c c10 = m5.c.f16897i.c(fileInputStream);
y7.g.b(c10, "MovieEntity.ADAPTER.decode(it)");
n nVar = new n(c10, file);
fileInputStream.close();
return nVar;
} catch (Exception e10) {
file.delete();
file2.delete();
throw e10;
}
}
File file3 = new File(file, "movie.spec");
if (!file3.isFile()) {
file3 = null;
}
if (file3 != null) {
try {
FileInputStream fileInputStream2 = new FileInputStream(file3);
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
byte[] bArr = new byte[2048];
while (true) {
int read = fileInputStream2.read(bArr, 0, 2048);
if (read == -1) {
String byteArrayOutputStream2 = byteArrayOutputStream.toString();
Objects.requireNonNull(byteArrayOutputStream2);
JSONObject jSONObject = new JSONObject(byteArrayOutputStream2);
fileInputStream2.close();
return new n(jSONObject, file);
}
byteArrayOutputStream.write(bArr, 0, read);
}
} catch (Exception e11) {
file.delete();
file3.delete();
throw e11;
}
}
return null;
e9.printStackTrace();
return null;
}
private final byte[] m(InputStream inputStream) {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
byte[] bArr = new byte[2048];
while (true) {
int read = inputStream.read(bArr, 0, 2048);
if (read <= 0) {
byte[] byteArray = byteArrayOutputStream.toByteArray();
y7.g.b(byteArray, "byteArrayOutputStream.toByteArray()");
return byteArray;
}
byteArrayOutputStream.write(bArr, 0, read);
}
}
private final void n(InputStream inputStream, String str) {
boolean h9;
File d10 = d(str);
d10.mkdirs();
ZipInputStream zipInputStream = new ZipInputStream(new BufferedInputStream(inputStream));
while (true) {
ZipEntry nextEntry = zipInputStream.getNextEntry();
if (nextEntry != null) {
h9 = e8.o.h(nextEntry.getName(), "/", false, 2, null);
if (!h9) {
FileOutputStream fileOutputStream = new FileOutputStream(new File(d10, nextEntry.getName()));
byte[] bArr = new byte[2048];
while (true) {
int read = zipInputStream.read(bArr);
if (read <= 0) {
break;
}
fileOutputStream.write(bArr, 0, read);
}
fileOutputStream.close();
zipInputStream.closeEntry();
}
} else {
zipInputStream.close();
return;
}
}
}
public final void i(InputStream inputStream, String str, b bVar) {
y7.g.f(inputStream, "inputStream");
y7.g.f(str, "cacheKey");
y7.g.f(bVar, "callback");
new Thread(new f(inputStream, str, bVar)).start();
}
public final void j(String str, b bVar) {
y7.g.f(str, "assetsName");
y7.g.f(bVar, "callback");
try {
InputStream open = this.f16691b.getAssets().open(str);
if (open != null) {
i(open, e("file:///assets/" + str), bVar);
n7.l lVar = n7.l.f17133a;
}
} catch (Exception unused) {
}
}
public final void k(URL url, b bVar) {
n l9;
y7.g.f(url, SocialConstants.PARAM_URL);
y7.g.f(bVar, "callback");
if (d(f(url)).exists() && (l9 = l(f(url))) != null) {
new Handler(this.f16691b.getMainLooper()).post(new c(l9, this, bVar));
} else {
this.f16690a.a(url, new d(url, bVar), new e(bVar));
}
}
}