WJBET v2.4.39版本的 MD5 值为:a1cc3f24c34b916fdf36d9b31dec8203

以下内容为反编译后的 ModelLoadServiceImpl.java 源代码,内容仅作参考


package com.ap.zoloz.hot.download.impl;

import com.alipay.mobile.security.bio.utils.BioLog;
import com.ap.zoloz.hot.download.FileUtils;
import com.ap.zoloz.hot.download.ModelLoadService;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
public class ModelLoadServiceImpl extends ModelLoadService {
    private final String URL_PATH = "https://zoloz-pipe.oss-ap-southeast-1.aliyuncs.com/zmodel/";
    private final int CONNECT_TIME_OUT = 10000;

    @Override
    public String download(String str, String str2) {
        try {
            HttpURLConnection httpURLConnection = (HttpURLConnection) new URL("https://zoloz-pipe.oss-ap-southeast-1.aliyuncs.com/zmodel/" + str).openConnection();
            httpURLConnection.setConnectTimeout(10000);
            InputStream inputStream = httpURLConnection.getInputStream();
            byte[] readInputStream = readInputStream(inputStream);
            File file = new File(str2);
            if (!file.exists()) {
                file.mkdir();
            }
            String str3 = str2 + File.separator + str;
            FileOutputStream fileOutputStream = new FileOutputStream(new File(str3));
            fileOutputStream.write(readInputStream);
            fileOutputStream.close();
            if (inputStream != null) {
                inputStream.close();
            }
            String fileMD5 = FileUtils.getFileMD5(str3);
            BioLog.i("ModelDownloadTask_file_md5 " + fileMD5 + ", fileMD5 " + str);
            if (str.equalsIgnoreCase(fileMD5)) {
                return str3;
            }
            return null;
        } catch (Throwable th) {
            BioLog.e(th);
            return null;
        }
    }

    private byte[] readInputStream(InputStream inputStream) throws IOException {
        byte[] bArr = new byte[1024];
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        while (true) {
            int read = inputStream.read(bArr);
            if (read != -1) {
                byteArrayOutputStream.write(bArr, 0, read);
            } else {
                byteArrayOutputStream.close();
                return byteArrayOutputStream.toByteArray();
            }
        }
    }
}