导航菜单

页面标题

页面副标题

Uptodown App Store v6.80 - C1239a.java 源代码

正在查看: Uptodown App Store v6.80 应用的 C1239a.java JAVA 源代码文件

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


package v2;

import g2.C0949J;
import h2.AbstractResultReceiverC0978d;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.MalformedURLException;
import java.net.ProtocolException;
import java.net.SocketTimeoutException;
import java.net.URL;
import java.net.URLConnection;
import java.nio.charset.Charset;
import java.util.zip.Inflater;
import java.util.zip.InflaterInputStream;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLHandshakeException;
import kotlin.jvm.internal.m;
import m3.d;
import org.json.JSONObject;
import u2.I;
import u2.w;

public final class C1239a {
    private HttpsURLConnection a;
    private OutputStream b;
    private final String c = "--";
    private final String d = "SwA" + System.currentTimeMillis() + "SwA";
    private long e;

    public C1239a(AbstractResultReceiverC0978d abstractResultReceiverC0978d) {
    }

    private final C0949J g(Exception exc, C0949J c0949j, String str) {
        c0949j.h(str);
        if (exc.getMessage() != null) {
            c0949j.i(exc.getMessage());
            return c0949j;
        }
        c0949j.i(exc.toString());
        return c0949j;
    }

    private final void l(String str, String str2) {
        OutputStream outputStream = this.b;
        m.b(outputStream);
        String str3 = this.c + this.d + "\r\n";
        Charset charset = d.b;
        byte[] bytes = str3.getBytes(charset);
        m.d(bytes, "getBytes(...)");
        outputStream.write(bytes);
        OutputStream outputStream2 = this.b;
        m.b(outputStream2);
        byte[] bytes2 = "Content-Type: text/plain\r\n".getBytes(charset);
        m.d(bytes2, "getBytes(...)");
        outputStream2.write(bytes2);
        OutputStream outputStream3 = this.b;
        m.b(outputStream3);
        byte[] bytes3 = ("Content-Disposition: form-data; name=\"" + str + "\"\r\n").getBytes(charset);
        m.d(bytes3, "getBytes(...)");
        outputStream3.write(bytes3);
        OutputStream outputStream4 = this.b;
        m.b(outputStream4);
        byte[] bytes4 = ("\r\n" + str2 + "\r\n").getBytes(charset);
        m.d(bytes4, "getBytes(...)");
        outputStream4.write(bytes4);
    }

    public final void a(String paramName, String fileName, byte[] bytes, JSONObject jSONObject) {
        m.e(paramName, "paramName");
        m.e(fileName, "fileName");
        m.e(bytes, "bytes");
        try {
            OutputStream outputStream = this.b;
            m.b(outputStream);
            String str = this.c + this.d + "\r\n";
            Charset charset = d.b;
            byte[] bytes2 = str.getBytes(charset);
            m.d(bytes2, "getBytes(...)");
            outputStream.write(bytes2);
            OutputStream outputStream2 = this.b;
            m.b(outputStream2);
            byte[] bytes3 = ("Content-Disposition: form-data; name=\"" + paramName + "\"; filename=\"" + fileName + "\"\r\n").getBytes(charset);
            m.d(bytes3, "getBytes(...)");
            outputStream2.write(bytes3);
            OutputStream outputStream3 = this.b;
            m.b(outputStream3);
            byte[] bytes4 = "Content-Type: application/octet-stream\r\n".getBytes(charset);
            m.d(bytes4, "getBytes(...)");
            outputStream3.write(bytes4);
            OutputStream outputStream4 = this.b;
            m.b(outputStream4);
            byte[] bytes5 = "Content-Transfer-Encoding: binary\r\n".getBytes(charset);
            m.d(bytes5, "getBytes(...)");
            outputStream4.write(bytes5);
            OutputStream outputStream5 = this.b;
            m.b(outputStream5);
            byte[] bytes6 = "\r\n".getBytes(charset);
            m.d(bytes6, "getBytes(...)");
            outputStream5.write(bytes6);
            OutputStream outputStream6 = this.b;
            m.b(outputStream6);
            outputStream6.write(bytes, 0, bytes.length);
            OutputStream outputStream7 = this.b;
            m.b(outputStream7);
            byte[] bytes7 = "\r\n".getBytes(charset);
            m.d(bytes7, "getBytes(...)");
            outputStream7.write(bytes7);
        } catch (IOException unused) {
            OutputStream outputStream8 = this.b;
            m.b(outputStream8);
            outputStream8.close();
        } catch (Exception unused2) {
            OutputStream outputStream9 = this.b;
            m.b(outputStream9);
            outputStream9.close();
        } catch (OutOfMemoryError unused3) {
            OutputStream outputStream10 = this.b;
            m.b(outputStream10);
            outputStream10.close();
        }
    }

    public final long b(String paramName, String fileName, String str) {
        m.e(paramName, "paramName");
        m.e(fileName, "fileName");
        long j = 0;
        try {
            OutputStream outputStream = this.b;
            m.b(outputStream);
            String str2 = this.c + this.d + "\r\n";
            Charset charset = d.b;
            byte[] bytes = str2.getBytes(charset);
            m.d(bytes, "getBytes(...)");
            outputStream.write(bytes);
            OutputStream outputStream2 = this.b;
            m.b(outputStream2);
            byte[] bytes2 = ("Content-Disposition: form-data; name=\"" + paramName + "\"; filename=\"" + fileName + "\"\r\n").getBytes(charset);
            m.d(bytes2, "getBytes(...)");
            outputStream2.write(bytes2);
            OutputStream outputStream3 = this.b;
            m.b(outputStream3);
            byte[] bytes3 = "Content-Type: application/octet-stream\r\n".getBytes(charset);
            m.d(bytes3, "getBytes(...)");
            outputStream3.write(bytes3);
            OutputStream outputStream4 = this.b;
            m.b(outputStream4);
            byte[] bytes4 = "Content-Transfer-Encoding: binary\r\n".getBytes(charset);
            m.d(bytes4, "getBytes(...)");
            outputStream4.write(bytes4);
            OutputStream outputStream5 = this.b;
            m.b(outputStream5);
            byte[] bytes5 = "\r\n".getBytes(charset);
            m.d(bytes5, "getBytes(...)");
            outputStream5.write(bytes5);
            FileInputStream fileInputStream = new FileInputStream(str);
            byte[] bArr = new byte[8192];
            while (true) {
                int read = fileInputStream.read(bArr);
                if (read <= 0) {
                    fileInputStream.close();
                    OutputStream outputStream6 = this.b;
                    m.b(outputStream6);
                    byte[] bytes6 = "\r\n".getBytes(d.b);
                    m.d(bytes6, "getBytes(...)");
                    outputStream6.write(bytes6);
                    return j;
                }
                OutputStream outputStream7 = this.b;
                m.b(outputStream7);
                outputStream7.write(bArr, 0, read);
                j += read;
            }
        } catch (IOException unused) {
            OutputStream outputStream8 = this.b;
            if (outputStream8 != null) {
                outputStream8.close();
            }
            return j;
        } catch (Exception unused2) {
            OutputStream outputStream9 = this.b;
            if (outputStream9 != null) {
                outputStream9.close();
            }
            return j;
        } catch (OutOfMemoryError unused3) {
            OutputStream outputStream10 = this.b;
            if (outputStream10 != null) {
                outputStream10.close();
            }
            return j;
        }
    }

    public final void c(String paramName, String value) {
        m.e(paramName, "paramName");
        m.e(value, "value");
        l(paramName, value);
    }

    public final void d(URL url, String str) {
        m.e(url, "url");
        URLConnection openConnection = url.openConnection();
        m.c(openConnection, "null cannot be cast to non-null type javax.net.ssl.HttpsURLConnection");
        HttpsURLConnection httpsURLConnection = (HttpsURLConnection) openConnection;
        this.a = httpsURLConnection;
        m.b(httpsURLConnection);
        httpsURLConnection.setRequestMethod("POST");
        HttpsURLConnection httpsURLConnection2 = this.a;
        m.b(httpsURLConnection2);
        httpsURLConnection2.setReadTimeout(30000);
        HttpsURLConnection httpsURLConnection3 = this.a;
        m.b(httpsURLConnection3);
        httpsURLConnection3.setConnectTimeout(30000);
        HttpsURLConnection httpsURLConnection4 = this.a;
        m.b(httpsURLConnection4);
        httpsURLConnection4.setDoInput(true);
        HttpsURLConnection httpsURLConnection5 = this.a;
        m.b(httpsURLConnection5);
        httpsURLConnection5.setDoOutput(true);
        HttpsURLConnection httpsURLConnection6 = this.a;
        m.b(httpsURLConnection6);
        httpsURLConnection6.setRequestProperty("Connection", "Keep-Alive");
        HttpsURLConnection httpsURLConnection7 = this.a;
        m.b(httpsURLConnection7);
        httpsURLConnection7.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + this.d);
        HttpsURLConnection httpsURLConnection8 = this.a;
        m.b(httpsURLConnection8);
        httpsURLConnection8.setRequestProperty("Accept-Charset", "utf-8");
        HttpsURLConnection httpsURLConnection9 = this.a;
        m.b(httpsURLConnection9);
        httpsURLConnection9.setRequestProperty("Accept", "application/json");
        HttpsURLConnection httpsURLConnection10 = this.a;
        m.b(httpsURLConnection10);
        httpsURLConnection10.setRequestProperty("Identificador", "Uptodown_Android");
        HttpsURLConnection httpsURLConnection11 = this.a;
        m.b(httpsURLConnection11);
        httpsURLConnection11.setRequestProperty("apk_file", str);
        HttpsURLConnection httpsURLConnection12 = this.a;
        m.b(httpsURLConnection12);
        httpsURLConnection12.setRequestProperty("Identificador-Version", "680");
        HttpsURLConnection httpsURLConnection13 = this.a;
        m.b(httpsURLConnection13);
        httpsURLConnection13.setRequestProperty("APIKEY", I.a.e());
        w wVar = w.a;
        HttpsURLConnection httpsURLConnection14 = this.a;
        m.b(httpsURLConnection14);
        wVar.a(httpsURLConnection14);
        HttpsURLConnection httpsURLConnection15 = this.a;
        m.b(httpsURLConnection15);
        httpsURLConnection15.setFixedLengthStreamingMode((int) this.e);
        HttpsURLConnection httpsURLConnection16 = this.a;
        m.b(httpsURLConnection16);
        httpsURLConnection16.connect();
        HttpsURLConnection httpsURLConnection17 = this.a;
        m.b(httpsURLConnection17);
        this.b = httpsURLConnection17.getOutputStream();
    }

    public final void e() {
        OutputStream outputStream = this.b;
        m.b(outputStream);
        byte[] bytes = (this.c + this.d + this.c + "\r\n").getBytes(d.b);
        m.d(bytes, "getBytes(...)");
        outputStream.write(bytes);
        OutputStream outputStream2 = this.b;
        m.b(outputStream2);
        outputStream2.close();
    }

    public final C0949J f(boolean z) {
        InputStream errorStream;
        boolean z3;
        C0949J c0949j = new C0949J();
        try {
            HttpsURLConnection httpsURLConnection = this.a;
            m.b(httpsURLConnection);
            int responseCode = httpsURLConnection.getResponseCode();
            c0949j.k(responseCode);
            if (responseCode < 200 || responseCode >= 300) {
                HttpsURLConnection httpsURLConnection2 = this.a;
                m.b(httpsURLConnection2);
                errorStream = httpsURLConnection2.getErrorStream();
                if (errorStream == null) {
                    HttpsURLConnection httpsURLConnection3 = this.a;
                    m.b(httpsURLConnection3);
                    errorStream = httpsURLConnection3.getInputStream();
                }
                z3 = false;
            } else {
                HttpsURLConnection httpsURLConnection4 = this.a;
                m.b(httpsURLConnection4);
                errorStream = httpsURLConnection4.getInputStream();
                if (errorStream == null) {
                    HttpsURLConnection httpsURLConnection5 = this.a;
                    m.b(httpsURLConnection5);
                    errorStream = httpsURLConnection5.getErrorStream();
                }
                z3 = true;
            }
            StringBuilder sb = new StringBuilder();
            byte[] bArr = new byte[1024];
            if (z3 && z) {
                InflaterInputStream inflaterInputStream = new InflaterInputStream(errorStream, new Inflater(true));
                while (true) {
                    int read = inflaterInputStream.read(bArr);
                    if (read == -1) {
                        break;
                    }
                    sb.append(new String(bArr, 0, read, d.b));
                }
                c0949j.i(sb.toString());
                inflaterInputStream.close();
            } else {
                while (true) {
                    int read2 = errorStream.read(bArr);
                    if (read2 == -1) {
                        break;
                    }
                    sb.append(new String(bArr, 0, read2, d.b));
                }
                c0949j.i(sb.toString());
            }
            errorStream.close();
            HttpsURLConnection httpsURLConnection6 = this.a;
            m.b(httpsURLConnection6);
            httpsURLConnection6.disconnect();
            return c0949j;
        } catch (IllegalArgumentException e) {
            return g(e, c0949j, "IllegalArgumentException");
        } catch (IllegalStateException e4) {
            return g(e4, c0949j, "IllegalStateException");
        } catch (NullPointerException e5) {
            return g(e5, c0949j, "NullPointerException");
        } catch (SecurityException e6) {
            return g(e6, c0949j, "SecurityException");
        } catch (MalformedURLException e7) {
            return g(e7, c0949j, "MalformedURLException");
        } catch (ProtocolException e8) {
            return g(e8, c0949j, "ProtocolException");
        } catch (SocketTimeoutException e9) {
            return g(e9, c0949j, "SocketTimeoutException");
        } catch (SSLHandshakeException e10) {
            return g(e10, c0949j, "SSLHandshakeException");
        } catch (IOException e11) {
            return g(e11, c0949j, "IOException");
        }
    }

    public final void h(String paramName, String fileName, byte[] bytes) {
        m.e(paramName, "paramName");
        m.e(fileName, "fileName");
        m.e(bytes, "bytes");
        long length = this.e + (this.c + this.d + "\r\n").length();
        this.e = length;
        long j = 2;
        long length2 = length + ("Content-Disposition: form-data; name=\"" + paramName + "\"; filename=\"" + fileName + "\"\r\n").length() + 40 + 35 + j;
        this.e = length2;
        this.e = length2 + ((long) bytes.length) + j;
    }

    public final void i(String paramName, String fileName, long j) {
        m.e(paramName, "paramName");
        m.e(fileName, "fileName");
        long length = this.e + (this.c + this.d + "\r\n").length();
        this.e = length;
        long j4 = 2;
        this.e = length + ("Content-Disposition: form-data; name=\"" + paramName + "\"; filename=\"" + fileName + "\"\r\n").length() + 40 + 35 + j4 + j + j4;
    }

    public final void j() {
        this.e = this.e + (this.c + this.d + this.c + "\r\n").length();
    }

    public final void k(String paramName, String value) {
        m.e(paramName, "paramName");
        m.e(value, "value");
        long length = this.e + (this.c + this.d + "\r\n").length() + 26;
        this.e = length;
        long length2 = length + ("Content-Disposition: form-data; name=\"" + paramName + "\"\r\n").length();
        this.e = length2;
        this.e = length2 + ("\r\n" + value + "\r\n").length();
    }
}