导航菜单

页面标题

页面副标题

絮语 v9.07 - f.java 源代码

正在查看: 絮语 v9.07 应用的 f.java JAVA 源代码文件

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


package i.runlibrary.a;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.net.CookieManager;
import java.net.CookiePolicy;
import java.net.CookieStore;
import java.net.HttpCookie;
import java.net.HttpURLConnection;
import java.net.InetSocketAddress;
import java.net.MalformedURLException;
import java.net.Proxy;
import java.net.URI;
import java.net.URL;
import java.net.URLConnection;
import java.security.SecureRandom;
import java.util.Random;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.KeyManager;
import javax.net.ssl.SSLContext;
import javax.net.ssl.X509TrustManager;

public final class f {
    private static CookieManager a;
    private static X509TrustManager[] b;

    public static int a(String str, String str2, boolean z) {
        URLConnection uRLConnection;
        int i2 = 0;
        d.a(str2, false);
        File file = new File(str2);
        File file2 = new File(file.getParent() + "/" + new Random().nextLong() + ".xzz");
        FileOutputStream fileOutputStream = null;
        try {
            uRLConnection = new URL(b(str)).openConnection();
            try {
                if (uRLConnection instanceof HttpsURLConnection) {
                    a((HttpsURLConnection) uRLConnection);
                }
                if (file.exists() && !z) {
                    if (uRLConnection.getContentLength() == file.length()) {
                        return 1;
                    }
                }
            } catch (MalformedURLException e) {
                e = e;
                e.printStackTrace();
                if (uRLConnection == null) {
                }
            } catch (IOException e2) {
                e = e2;
                e.printStackTrace();
                if (uRLConnection == null) {
                }
            }
        } catch (MalformedURLException e3) {
            e = e3;
            uRLConnection = null;
        } catch (IOException e4) {
            e = e4;
            uRLConnection = null;
        }
        if (uRLConnection == null) {
            return -1;
        }
        try {
            InputStream inputStream = uRLConnection.getInputStream();
            try {
                file2.createNewFile();
                try {
                    try {
                        byte[] bArr = new byte[1024];
                        FileOutputStream fileOutputStream2 = new FileOutputStream(file2);
                        while (true) {
                            try {
                                int read = inputStream.read(bArr);
                                if (read != -1) {
                                    fileOutputStream2.write(bArr, 0, read);
                                } else {
                                    try {
                                        break;
                                    } catch (IOException e5) {
                                        e5.printStackTrace();
                                    }
                                }
                            } catch (IOException e6) {
                                e = e6;
                                fileOutputStream = fileOutputStream2;
                                e.printStackTrace();
                                try {
                                    file2.delete();
                                } catch (Exception unused) {
                                    e.printStackTrace();
                                }
                                try {
                                    fileOutputStream.close();
                                } catch (IOException e7) {
                                    e7.printStackTrace();
                                }
                                try {
                                    inputStream.close();
                                } catch (IOException e8) {
                                    e8.printStackTrace();
                                }
                                i2 = -1;
                                if (i2 == 0) {
                                }
                                return i2;
                            } catch (Throwable th) {
                                th = th;
                                fileOutputStream = fileOutputStream2;
                                try {
                                    fileOutputStream.close();
                                } catch (IOException e9) {
                                    e9.printStackTrace();
                                }
                                try {
                                    inputStream.close();
                                    throw th;
                                } catch (IOException e10) {
                                    e10.printStackTrace();
                                    throw th;
                                }
                            }
                        }
                        fileOutputStream2.close();
                        try {
                            inputStream.close();
                        } catch (IOException e11) {
                            e11.printStackTrace();
                        }
                    } catch (Throwable th2) {
                        th = th2;
                        fileOutputStream.close();
                        inputStream.close();
                        throw th;
                    }
                } catch (IOException e12) {
                    e = e12;
                }
                if (i2 == 0) {
                    if (file.exists()) {
                        file.delete();
                    }
                    try {
                        file2.renameTo(file);
                    } catch (Exception e13) {
                        e13.printStackTrace();
                    }
                }
                return i2;
            } catch (IOException e14) {
                e14.printStackTrace();
                return -1;
            }
        } catch (IOException e15) {
            e15.printStackTrace();
            return -1;
        }
    }

    public static int a(String str, String str2, boolean z, String[] strArr, String str3, String str4, boolean z2, String str5) {
        d.a(str2, false);
        File file = new File(str2);
        File file2 = new File(file.getParent() + "/" + new Random().nextLong() + ".xzz");
        try {
            URL url = new URL(b(str));
            HttpURLConnection a2 = a(url);
            if (str5 != null) {
                for (String str6 : str5.split("\\|\\|")) {
                    int indexOf = str6.indexOf(61);
                    if (indexOf != -1) {
                        a2.setRequestProperty(str6.substring(0, indexOf).trim(), str6.substring(indexOf + 1).trim());
                    }
                }
            }
            if (str4 != null) {
                a2.setRequestProperty("Cookie", str4);
            } else if (z2) {
                a(a2, url.toURI());
            }
            a(a2, strArr, str3);
            int responseCode = a2.getResponseCode();
            int i2 = 0;
            while (responseCode >= 300 && responseCode < 400 && i2 <= 8) {
                a().put(url.toURI(), a2.getHeaderFields());
                String headerField = a2.getHeaderField("Location");
                if (headerField == null) {
                    break;
                }
                URL url2 = new URL(b(u.a(url.toURI(), headerField)));
                a2.disconnect();
                a2 = a(url2);
                a(a2, url2.toURI());
                a(a2, (String[]) null, str3);
                i2++;
                responseCode = a2.getResponseCode();
                url = url2;
            }
            if (responseCode == 200) {
                if (z2) {
                    a().put(url.toURI(), a2.getHeaderFields());
                }
                InputStream inputStream = a2.getInputStream();
                if (file.exists() && !z && (inputStream.available() == file.length() || a2.getContentLength() == file.length())) {
                    if (inputStream == null) {
                        return 1;
                    }
                    inputStream.close();
                    return 1;
                }
                file2.createNewFile();
                byte[] bArr = new byte[1024];
                FileOutputStream fileOutputStream = new FileOutputStream(file2);
                while (true) {
                    int read = inputStream.read(bArr);
                    if (read == -1) {
                        break;
                    }
                    fileOutputStream.write(bArr, 0, read);
                }
                if (file.exists()) {
                    file.delete();
                }
                file2.renameTo(file);
                inputStream.close();
                fileOutputStream.close();
                return 0;
            }
        } catch (Exception e) {
            e.printStackTrace();
            try {
                file2.delete();
            } catch (Exception unused) {
                e.printStackTrace();
            }
        }
        return -1;
    }

    public static int a(byte[] bArr) {
        StringBuilder sb = new StringBuilder();
        boolean z = false;
        for (int i2 = 7; i2 < 17; i2++) {
            if (!z && bArr[i2] != 0) {
                z = true;
            }
            if (z) {
                sb.append((int) bArr[i2]);
            }
        }
        if (sb.length() > 0) {
            try {
                return Integer.parseInt(sb.toString());
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return 0;
    }

    public static String a(String str) {
        if (str == null) {
            return null;
        }
        String str2 = "";
        if (str.equals("cookie")) {
            for (HttpCookie httpCookie : a().getCookieStore().getCookies()) {
                str2 = str2 + httpCookie.getName() + "=" + httpCookie.getValue() + ";";
            }
            return str2;
        }
        if (str.equals("del cookie")) {
            a = null;
        } else {
            try {
                URI uri = new URI(str);
                CookieStore cookieStore = a().getCookieStore();
                String lowerCase = uri.getHost().toLowerCase();
                for (HttpCookie httpCookie2 : cookieStore.getCookies()) {
                    String lowerCase2 = httpCookie2.getDomain().toLowerCase();
                    if ((lowerCase2.startsWith(".") && lowerCase.endsWith(lowerCase2.substring(1))) || lowerCase.endsWith(lowerCase2)) {
                        str2 = str2 + httpCookie2.getName() + "=" + httpCookie2.getValue() + ";";
                    }
                }
                return str2;
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return null;
    }

    public static String a(String str, String str2, String str3) {
        if (str3 == null) {
            str3 = "utf-8";
        }
        try {
            URL url = new URL(b(str));
            return a(url, a(url), str2, str3, false);
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

    public static String a(String str, String str2, String str3, String str4) {
        try {
            URL url = new URL(b(str));
            HttpURLConnection a2 = a(url);
            a2.setConnectTimeout(20000);
            a2.setReadTimeout(20000);
            if (str4 != null) {
                a2.setRequestProperty("Cookie", str4);
            }
            return a(url, a2, str2, str3, false);
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

    public static String a(String str, String str2, String str3, String str4, boolean z) {
        try {
            URL url = new URL(b(str));
            HttpURLConnection a2 = a(url);
            a2.setConnectTimeout(20000);
            a2.setReadTimeout(20000);
            if (str4 != null) {
                a2.setRequestProperty("Cookie", str4);
            } else if (z) {
                a(a2, url.toURI());
            }
            return a(url, a2, str2, str3, z);
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

    public static String a(String str, String str2, String str3, String str4, boolean z, String str5, int i2, int i3, String str6) {
        int i4;
        URLConnection openConnection;
        try {
            URL url = new URL(b(str));
            if (str6 == null) {
                openConnection = url.openConnection();
            } else {
                int indexOf = str6.indexOf(58);
                if (indexOf != -1) {
                    String substring = str6.substring(0, indexOf);
                    i4 = Integer.parseInt(str6.substring(indexOf + 1));
                    str6 = substring;
                } else {
                    i4 = 80;
                }
                openConnection = url.openConnection(new Proxy(Proxy.Type.HTTP, new InetSocketAddress(str6, i4)));
            }
            HttpURLConnection httpURLConnection = (HttpURLConnection) openConnection;
            httpURLConnection.setRequestProperty("User-Agent", "Apache-HttpClient/UNAVAILABLE (java 1.4)");
            httpURLConnection.setRequestProperty("Accept-Encoding", "identity");
            httpURLConnection.setConnectTimeout(i2);
            httpURLConnection.setReadTimeout(i3);
            if (str5 != null) {
                for (String str7 : str5.split("\\|\\|")) {
                    int indexOf2 = str7.indexOf(61);
                    if (indexOf2 != -1) {
                        httpURLConnection.setRequestProperty(str7.substring(0, indexOf2).trim(), str7.substring(indexOf2 + 1).trim());
                    }
                }
            }
            if (str4 != null) {
                httpURLConnection.setRequestProperty("Cookie", str4);
            } else if (z) {
                a(httpURLConnection, url.toURI());
            }
            return a(url, httpURLConnection, str2, str3, z);
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

    public static String a(String str, String[] strArr, String str2) {
        if (str2 == null) {
            str2 = "utf-8";
        }
        try {
            URL url = new URL(b(str));
            return a(url, a(url), strArr, str2, false);
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

    public static String a(String str, String[] strArr, String str2, String str3) {
        try {
            URL url = new URL(b(str));
            HttpURLConnection a2 = a(url);
            a2.setConnectTimeout(20000);
            a2.setReadTimeout(20000);
            if (str3 != null) {
                a2.setRequestProperty("Cookie", str3);
            }
            return a(url, a2, strArr, str2, false);
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

    public static String a(String str, String[] strArr, String str2, String str3, boolean z) {
        try {
            URL url = new URL(b(str));
            HttpURLConnection a2 = a(url);
            a2.setConnectTimeout(20000);
            a2.setReadTimeout(20000);
            if (str3 != null) {
                a2.setRequestProperty("Cookie", str3);
            } else if (z) {
                a(a2, url.toURI());
            }
            return a(url, a2, strArr, str2, z);
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

    public static String a(String str, String[] strArr, String str2, String str3, boolean z, String str4, int i2, int i3, String str5) {
        int i4;
        URLConnection openConnection;
        try {
            URL url = new URL(b(str));
            if (str5 == null) {
                openConnection = url.openConnection();
            } else {
                int indexOf = str5.indexOf(58);
                if (indexOf != -1) {
                    String substring = str5.substring(0, indexOf);
                    i4 = Integer.parseInt(str5.substring(indexOf + 1));
                    str5 = substring;
                } else {
                    i4 = 80;
                }
                openConnection = url.openConnection(new Proxy(Proxy.Type.HTTP, new InetSocketAddress(str5, i4)));
            }
            HttpURLConnection httpURLConnection = (HttpURLConnection) openConnection;
            httpURLConnection.setRequestProperty("User-Agent", "Apache-HttpClient/UNAVAILABLE (java 1.4)");
            httpURLConnection.setRequestProperty("Accept-Encoding", "identity");
            httpURLConnection.setConnectTimeout(i2);
            httpURLConnection.setReadTimeout(i3);
            if (str4 != null) {
                for (String str6 : str4.split("\\|\\|")) {
                    int indexOf2 = str6.indexOf(61);
                    if (indexOf2 != -1) {
                        httpURLConnection.setRequestProperty(str6.substring(0, indexOf2).trim(), str6.substring(indexOf2 + 1).trim());
                    }
                }
            }
            if (str3 != null) {
                httpURLConnection.setRequestProperty("Cookie", str3);
            } else if (z) {
                a(httpURLConnection, url.toURI());
            }
            return a(url, httpURLConnection, strArr, str2, z);
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

    public static String a(String str, String[] strArr, String[] strArr2, String str2, String str3) {
        String str4;
        String str5;
        String str6;
        try {
            HttpURLConnection httpURLConnection = (HttpURLConnection) new URL(b(str)).openConnection();
            httpURLConnection.setDoInput(true);
            httpURLConnection.setDoOutput(true);
            httpURLConnection.setUseCaches(false);
            httpURLConnection.setRequestMethod("POST");
            httpURLConnection.setRequestProperty("Connection", "Keep-Alive");
            httpURLConnection.setRequestProperty("Charset", str2);
            httpURLConnection.setRequestProperty("Content-Type", "multipart/form-data;boundary=******");
            int i2 = 61;
            int i3 = -1;
            if (str3 != null) {
                for (String str7 : str3.split("\\|\\|")) {
                    int indexOf = str7.indexOf(61);
                    if (indexOf != -1) {
                        httpURLConnection.setRequestProperty(str7.substring(0, indexOf).trim(), str7.substring(indexOf + 1).trim());
                    }
                }
            }
            DataOutputStream dataOutputStream = new DataOutputStream(httpURLConnection.getOutputStream());
            int length = strArr.length;
            int i4 = 0;
            while (i4 < length) {
                String str8 = strArr[i4];
                int indexOf2 = str8.indexOf(i2);
                if (indexOf2 != -1) {
                    dataOutputStream.writeBytes("--******\r\n");
                    dataOutputStream.writeBytes("Content-Disposition: form-data; name=\"" + str8.substring(0, indexOf2) + "\"\r\n");
                    dataOutputStream.writeBytes("\r\n");
                    dataOutputStream.write(str8.substring(indexOf2 + 1).getBytes(str2));
                    dataOutputStream.writeBytes("\r\n");
                }
                i4++;
                i2 = 61;
            }
            dataOutputStream.writeBytes("--******\r\n");
            String str9 = strArr2.length > 1 ? "file[]" : "file";
            int length2 = strArr2.length;
            int i5 = 0;
            boolean z = false;
            while (i5 < length2) {
                String str10 = strArr2[i5];
                int indexOf3 = str10.indexOf(10);
                if (indexOf3 != i3) {
                    String trim = str10.substring(indexOf3 + 1).trim();
                    str5 = str9;
                    str6 = str10.substring(0, indexOf3).trim();
                    str10 = trim;
                } else {
                    str5 = str9;
                    str6 = str5;
                }
                File file = new File(str10);
                if (file.exists()) {
                    if (z) {
                        dataOutputStream.writeBytes("--******\r\n");
                    }
                    dataOutputStream.write(("Content-Disposition: form-data; name=\"" + str6 + "\"; filename=\"" + file.getName() + "\"\r\nContent-Type: " + q.a(file) + "\r\n").getBytes(str2));
                    dataOutputStream.writeBytes("\r\n");
                    FileInputStream fileInputStream = new FileInputStream(file);
                    byte[] bArr = new byte[8192];
                    while (true) {
                        int read = fileInputStream.read(bArr);
                        if (read == -1) {
                            break;
                        }
                        dataOutputStream.write(bArr, 0, read);
                    }
                    fileInputStream.close();
                    dataOutputStream.writeBytes("\r\n");
                    z = true;
                }
                i5++;
                str9 = str5;
                i3 = -1;
            }
            dataOutputStream.writeBytes("--******--\r\n");
            dataOutputStream.flush();
            InputStream inputStream = httpURLConnection.getInputStream();
            BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream, str2));
            str4 = "";
            while (true) {
                try {
                    String readLine = bufferedReader.readLine();
                    if (readLine == null) {
                        break;
                    }
                    str4 = str4 + readLine;
                } catch (Exception e) {
                    e = e;
                    e.printStackTrace();
                    return str4;
                }
            }
            dataOutputStream.close();
            inputStream.close();
        } catch (Exception e2) {
            e = e2;
            str4 = null;
        }
        return str4;
    }

    private static String a(URL url, HttpURLConnection httpURLConnection, String str, String str2, boolean z) {
        StringBuffer stringBuffer;
        try {
            a(httpURLConnection, str, str2);
            int responseCode = httpURLConnection.getResponseCode();
            int i2 = 0;
            while (responseCode >= 300 && responseCode < 400 && i2 <= 8) {
                a().put(url.toURI(), httpURLConnection.getHeaderFields());
                String headerField = httpURLConnection.getHeaderField("Location");
                if (headerField == null) {
                    break;
                }
                URL url2 = new URL(b(u.a(url.toURI(), headerField)));
                httpURLConnection.disconnect();
                httpURLConnection = a(url2);
                a(httpURLConnection, url2.toURI());
                a(httpURLConnection, (String) null, str2);
                i2++;
                responseCode = httpURLConnection.getResponseCode();
                url = url2;
            }
            if (responseCode == 200) {
                if (z) {
                    a().put(url.toURI(), httpURLConnection.getHeaderFields());
                }
                InputStream inputStream = httpURLConnection.getInputStream();
                InputStreamReader inputStreamReader = new InputStreamReader(inputStream, str2);
                BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
                stringBuffer = new StringBuffer();
                try {
                    char[] cArr = new char[512];
                    while (true) {
                        int read = bufferedReader.read(cArr);
                        if (read <= 0) {
                            break;
                        }
                        stringBuffer.append(cArr, 0, read);
                    }
                    inputStream.close();
                    inputStreamReader.close();
                    bufferedReader.close();
                } catch (Exception e) {
                    e = e;
                    e.printStackTrace();
                    if (stringBuffer != null) {
                    }
                }
            } else {
                stringBuffer = null;
            }
        } catch (Exception e2) {
            e = e2;
            stringBuffer = null;
        }
        if (stringBuffer != null) {
            return null;
        }
        return stringBuffer.toString();
    }

    private static String a(URL url, HttpURLConnection httpURLConnection, String[] strArr, String str, boolean z) {
        StringBuffer stringBuffer;
        try {
            b(httpURLConnection, strArr, str);
            int responseCode = httpURLConnection.getResponseCode();
            int i2 = 0;
            while (responseCode >= 300 && responseCode < 400 && i2 <= 8) {
                a().put(url.toURI(), httpURLConnection.getHeaderFields());
                String headerField = httpURLConnection.getHeaderField("Location");
                if (headerField == null) {
                    break;
                }
                URL url2 = new URL(b(u.a(url.toURI(), headerField)));
                httpURLConnection.disconnect();
                httpURLConnection = a(url2);
                a(httpURLConnection, url2.toURI());
                b(httpURLConnection, null, str);
                i2++;
                responseCode = httpURLConnection.getResponseCode();
                url = url2;
            }
            if (responseCode == 200) {
                if (z) {
                    a().put(url.toURI(), httpURLConnection.getHeaderFields());
                }
                InputStream inputStream = httpURLConnection.getInputStream();
                InputStreamReader inputStreamReader = new InputStreamReader(inputStream, str);
                BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
                stringBuffer = new StringBuffer();
                try {
                    char[] cArr = new char[512];
                    while (true) {
                        int read = bufferedReader.read(cArr);
                        if (read <= 0) {
                            break;
                        }
                        stringBuffer.append(cArr, 0, read);
                    }
                    inputStream.close();
                    inputStreamReader.close();
                    bufferedReader.close();
                } catch (Exception e) {
                    e = e;
                    e.printStackTrace();
                    if (stringBuffer != null) {
                    }
                }
            } else {
                stringBuffer = null;
            }
        } catch (Exception e2) {
            e = e2;
            stringBuffer = null;
        }
        if (stringBuffer != null) {
            return null;
        }
        return stringBuffer.toString();
    }

    private static CookieManager a() {
        if (a == null) {
            CookieManager cookieManager = new CookieManager();
            a = cookieManager;
            cookieManager.setCookiePolicy(CookiePolicy.ACCEPT_ALL);
        }
        return a;
    }

    private static HttpURLConnection a(URL url) {
        HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
        httpURLConnection.setRequestProperty("User-Agent", "Apache-HttpClient/UNAVAILABLE (java 1.4)");
        httpURLConnection.setRequestProperty("Accept-Encoding", "identity");
        return httpURLConnection;
    }

    public static void a(Context context, String str) {
        Intent intent = new Intent();
        intent.setAction("android.intent.action.VIEW");
        intent.setData(Uri.parse(str));
        context.startActivity(intent);
    }

    private static void a(HttpURLConnection httpURLConnection, String str, String str2) {
        if (httpURLConnection instanceof HttpsURLConnection) {
            a((HttpsURLConnection) httpURLConnection);
        }
        httpURLConnection.setUseCaches(false);
        httpURLConnection.setInstanceFollowRedirects(false);
        if (str != null) {
            httpURLConnection.setDoOutput(true);
            httpURLConnection.setRequestProperty("Charsert", str2);
            httpURLConnection.setRequestMethod("POST");
            httpURLConnection.setRequestProperty("Content-Type", "application/json; charset=" + str2);
            PrintWriter printWriter = new PrintWriter(new OutputStreamWriter(httpURLConnection.getOutputStream(), str2));
            printWriter.println(str);
            printWriter.flush();
            printWriter.close();
        }
        httpURLConnection.connect();
    }

    private static void a(HttpURLConnection httpURLConnection, URI uri) {
        try {
            CookieStore cookieStore = a().getCookieStore();
            String str = "";
            String lowerCase = uri.getHost().toLowerCase();
            for (HttpCookie httpCookie : cookieStore.getCookies()) {
                String lowerCase2 = httpCookie.getDomain().toLowerCase();
                if ((lowerCase2.startsWith(".") && lowerCase.endsWith(lowerCase2.substring(1))) || lowerCase.endsWith(lowerCase2)) {
                    str = str + httpCookie.getName() + "=" + httpCookie.getValue() + ";";
                }
            }
            if (str.length() > 0) {
                httpURLConnection.setRequestProperty("Cookie", str);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private static void a(HttpURLConnection httpURLConnection, String[] strArr, String str) {
        StringBuffer append;
        String str2;
        if (httpURLConnection instanceof HttpsURLConnection) {
            a((HttpsURLConnection) httpURLConnection);
        }
        httpURLConnection.setUseCaches(false);
        httpURLConnection.setInstanceFollowRedirects(false);
        if (strArr != null) {
            httpURLConnection.setDoOutput(true);
            httpURLConnection.setRequestMethod("POST");
            httpURLConnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
            OutputStream outputStream = httpURLConnection.getOutputStream();
            StringBuffer stringBuffer = new StringBuffer();
            for (int i2 = 0; i2 < strArr.length; i2++) {
                int indexOf = strArr[i2].indexOf(61);
                if (indexOf != -1) {
                    int i3 = indexOf + 1;
                    if (i2 == 0) {
                        append = stringBuffer.append(strArr[i2].substring(0, i3));
                        str2 = strArr[i2];
                    } else {
                        append = stringBuffer.append('&').append(strArr[i2].substring(0, i3));
                        str2 = strArr[i2];
                    }
                    append.append(t.a(str2.substring(i3), str));
                }
            }
            outputStream.write(stringBuffer.toString().getBytes());
            outputStream.flush();
            outputStream.close();
        }
        httpURLConnection.connect();
    }

    public static void a(HttpsURLConnection httpsURLConnection) {
        if (b == null) {
            b = new X509TrustManager[]{new g()};
        }
        try {
            SSLContext sSLContext = SSLContext.getInstance("TLS");
            sSLContext.init(new KeyManager[0], b, new SecureRandom());
            httpsURLConnection.setSSLSocketFactory(sSLContext.getSocketFactory());
            httpsURLConnection.setHostnameVerifier(new h());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static byte[] a(byte[] bArr, int i2, File file) {
        byte[] bArr2 = new byte[32];
        bArr2[0] = 32;
        bArr2[1] = -93;
        bArr2[2] = 93;
        bArr2[3] = 0;
        bArr2[4] = 63;
        bArr2[5] = -63;
        bArr2[6] = (byte) i2;
        bArr2[7] = 0;
        bArr2[8] = 0;
        bArr2[9] = 0;
        bArr2[10] = 0;
        bArr2[11] = 0;
        bArr2[12] = 0;
        bArr2[13] = 0;
        bArr2[14] = 0;
        bArr2[15] = 0;
        bArr2[16] = 0;
        int i3 = 17;
        bArr2[17] = 0;
        bArr2[18] = 0;
        bArr2[19] = 0;
        bArr2[20] = 0;
        bArr2[21] = 0;
        bArr2[22] = 0;
        bArr2[23] = 0;
        bArr2[24] = 0;
        bArr2[25] = 0;
        bArr2[26] = 0;
        bArr2[27] = 0;
        bArr2[28] = 0;
        bArr2[29] = 0;
        bArr2[30] = 0;
        bArr2[31] = 0;
        char[] charArray = String.valueOf(bArr.length).toCharArray();
        int length = (charArray.length > 10 ? 0 : 10 - charArray.length) + 7;
        for (char c : charArray) {
            if (length == 17) {
                break;
            }
            bArr2[length] = Byte.parseByte(String.valueOf(c));
            length++;
        }
        if (i2 == 2 && file != null) {
            String name = file.getName();
            int lastIndexOf = name.lastIndexOf(46);
            byte[] bytes = lastIndexOf != -1 ? name.substring(lastIndexOf + 1).getBytes() : null;
            if (bytes != null) {
                for (byte b2 : bytes) {
                    if (i3 == 32) {
                        break;
                    }
                    bArr2[i3] = b2;
                    i3++;
                }
            }
        }
        return bArr2;
    }

    private static String b(String str) {
        return str.replace(" ", "%20").replace("\\&", "%26");
    }

    public static String b(byte[] bArr) {
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        for (int i2 = 17; i2 < 32 && bArr[i2] != 0; i2++) {
            byteArrayOutputStream.write(bArr[i2]);
        }
        if (byteArrayOutputStream.size() == 0) {
            return null;
        }
        return new String(byteArrayOutputStream.toByteArray());
    }

    private static void b(HttpURLConnection httpURLConnection, String[] strArr, String str) {
        StringBuffer append;
        String str2;
        if (httpURLConnection instanceof HttpsURLConnection) {
            a((HttpsURLConnection) httpURLConnection);
        }
        httpURLConnection.setUseCaches(false);
        httpURLConnection.setInstanceFollowRedirects(false);
        if (strArr != null) {
            httpURLConnection.setDoOutput(true);
            httpURLConnection.setRequestMethod("POST");
            httpURLConnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
            OutputStream outputStream = httpURLConnection.getOutputStream();
            StringBuffer stringBuffer = new StringBuffer();
            for (int i2 = 0; i2 < strArr.length; i2++) {
                int indexOf = strArr[i2].indexOf(61);
                if (indexOf != -1) {
                    int i3 = indexOf + 1;
                    if (i2 == 0) {
                        append = stringBuffer.append(strArr[i2].substring(0, i3));
                        str2 = strArr[i2];
                    } else {
                        append = stringBuffer.append('&').append(strArr[i2].substring(0, i3));
                        str2 = strArr[i2];
                    }
                    append.append(t.a(str2.substring(i3), str));
                }
            }
            outputStream.write(stringBuffer.toString().getBytes());
            outputStream.flush();
            outputStream.close();
        }
        httpURLConnection.connect();
    }

    public static boolean c(byte[] bArr) {
        return bArr != null && bArr.length >= 32 && bArr[0] == 32 && bArr[1] == -93 && bArr[2] == 93 && bArr[3] == 0 && bArr[4] == 63 && bArr[5] == -63;
    }
}