翰林优商.apk(点击下载) / b.java


package com.sigmob.sdk.base.utils;

import android.content.Context;
import com.baidu.mobads.sdk.internal.az;
import com.czhj.sdk.common.utils.FileUtil;
import com.czhj.sdk.logger.SigmobLog;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.util.ArrayList;
import java.util.Arrays;

public final class b {
    public static String a = "SigHtmlResource";
    public static String b = "SigHtmlPrivacy";
    private static String c;
    private static String d;

    public static File a(Context context) {
        return new File(d, "SigDownload");
    }

    public static File a(String str, String str2) {
        try {
            File file = new File(d, a);
            if (!file.exists()) {
                file.mkdirs();
            }
            File file2 = new File(file, str2);
            SigmobLog.d("SigHtmlResource: " + file2.getAbsolutePath());
            if (file2.exists()) {
                file2.delete();
            }
            file2.createNewFile();
            FileWriter fileWriter = new FileWriter(file2, true);
            BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);
            bufferedWriter.write(str);
            bufferedWriter.newLine();
            bufferedWriter.close();
            fileWriter.close();
            return file2;
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } catch (Throwable th) {
            th.printStackTrace();
            return null;
        }
    }

    public static String a() {
        return c;
    }

    public static synchronized String a(String str) {
        String str2;
        synchronized (b.class) {
            str2 = c + File.separator + "splashAdUnit" + File.separator + str;
        }
        return str2;
    }

    public static void a(Context context, String str) {
        File cacheDir = context.getCacheDir();
        File externalCacheDir = context.getExternalCacheDir();
        if (str != null) {
            File file = new File(cacheDir, str);
            if (!file.exists()) {
                file.mkdirs();
            }
            File file2 = new File(externalCacheDir, str);
            if (!file2.exists()) {
                file2.mkdirs();
            }
            externalCacheDir = file2;
            cacheDir = file;
        }
        c = cacheDir.getAbsolutePath();
        d = externalCacheDir.getAbsolutePath();
    }

    public static File[] a(File[] fileArr, int i) {
        if (fileArr == null || fileArr.length == 0) {
            return null;
        }
        ArrayList arrayList = new ArrayList(Arrays.asList(fileArr));
        for (int i2 = 0; i2 < fileArr.length && arrayList.size() > i; i2++) {
            File file = fileArr[i2];
            if (file.exists()) {
                file.delete();
                arrayList.remove(file);
                SigmobLog.d("file delete " + file.getName());
            }
        }
        return (File[]) arrayList.toArray(new File[0]);
    }

    public static File b(String str) {
        File file = new File(d, str);
        if (!file.exists()) {
            file.mkdirs();
        }
        return file;
    }

    public static String b() {
        String str = c + File.separator + "videoAd";
        File file = new File(str);
        if (!file.exists()) {
            file.mkdirs();
        }
        return str;
    }

    public static String c() {
        return d;
    }

    public static String d() {
        String str = c + File.separator + "splashAd";
        File file = new File(str);
        if (!file.exists()) {
            file.mkdirs();
        }
        return str;
    }

    public static String e() {
        String str = c + File.separator + "nativeAd";
        File file = new File(str);
        if (!file.exists()) {
            file.mkdirs();
        }
        return str;
    }

    public static String f() {
        String str = c + File.separator + "downloadAPKLog";
        File file = new File(str);
        if (!file.exists()) {
            file.mkdirs();
        }
        return str;
    }

    public static synchronized String g() {
        String str;
        synchronized (b.class) {
            str = c + File.separator + az.a + File.separator + "sdkLog.log";
        }
        return str;
    }

    public static void h() {
        if (c != null) {
            File file = new File(c);
            if (file.exists()) {
                FileUtil.deleteDirectory(c);
            }
            if (!file.exists() || file.isFile()) {
                file.mkdirs();
            }
        }
    }
}