导航菜单

页面标题

页面副标题

财通国际 v2.0 - a.java 源代码

正在查看: 财通国际 v2.0 应用的 a.java JAVA 源代码文件

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


package h0;

import com.taobao.weex.el.parse.Operators;
import com.umeng.commonsdk.statistics.SdkVersion;
import com.umeng.umcrash.UMCustomLogInfoBuilder;
import io.dcloud.common.util.JSUtil;
import java.io.BufferedWriter;
import java.io.Closeable;
import java.io.EOFException;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FilterOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Reader;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.concurrent.Callable;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.regex.Pattern;

public final class a implements Closeable {

    static final Pattern f1173o = Pattern.compile("[a-z0-9_-]{1,64}");

    private static final OutputStream f1174p = new b();
    private final File a;
    private final File b;
    private final File c;

    private final File f1175d;

    private final int f1176e;

    private long f1177f;

    private final int f1178g;

    private Writer f1180i;

    private int f1182k;

    private long f1179h = 0;

    private final LinkedHashMap f1181j = new LinkedHashMap(0, 0.75f, true);

    private long f1183l = 0;

    final ThreadPoolExecutor f1184m = new ThreadPoolExecutor(0, 1, 60, TimeUnit.SECONDS, new LinkedBlockingQueue());

    private final Callable f1185n = new CallableC0040a();

    class CallableC0040a implements Callable {
        CallableC0040a() {
        }

        @Override
        public Void call() {
            synchronized (a.this) {
                if (a.this.f1180i == null) {
                    return null;
                }
                a.this.h();
                if (a.this.d()) {
                    a.this.g();
                    a.this.f1182k = 0;
                }
                return null;
            }
        }
    }

    class b extends OutputStream {
        b() {
        }

        @Override
        public void write(int i2) {
        }
    }

    public final class c {
        private final d a;
        private final boolean[] b;
        private boolean c;

        private boolean f1186d;

        private class C0041a extends FilterOutputStream {
            private C0041a(OutputStream outputStream) {
                super(outputStream);
            }

            C0041a(c cVar, OutputStream outputStream, CallableC0040a callableC0040a) {
                this(outputStream);
            }

            @Override
            public void close() {
                try {
                    ((FilterOutputStream) this).out.close();
                } catch (IOException unused) {
                    c.this.c = true;
                }
            }

            @Override
            public void flush() {
                try {
                    ((FilterOutputStream) this).out.flush();
                } catch (IOException unused) {
                    c.this.c = true;
                }
            }

            @Override
            public void write(int i2) {
                try {
                    ((FilterOutputStream) this).out.write(i2);
                } catch (IOException unused) {
                    c.this.c = true;
                }
            }

            @Override
            public void write(byte[] bArr, int i2, int i3) {
                try {
                    ((FilterOutputStream) this).out.write(bArr, i2, i3);
                } catch (IOException unused) {
                    c.this.c = true;
                }
            }
        }

        private c(d dVar) {
            this.a = dVar;
            this.b = dVar.c ? null : new boolean[a.this.f1178g];
        }

        c(a aVar, d dVar, CallableC0040a callableC0040a) {
            this(dVar);
        }

        public OutputStream a(int i2) {
            FileOutputStream fileOutputStream;
            C0041a c0041a;
            synchronized (a.this) {
                if (this.a.f1188d != this) {
                    throw new IllegalStateException();
                }
                if (!this.a.c) {
                    this.b[i2] = true;
                }
                File b = this.a.b(i2);
                try {
                    fileOutputStream = new FileOutputStream(b);
                } catch (FileNotFoundException unused) {
                    a.this.a.mkdirs();
                    try {
                        fileOutputStream = new FileOutputStream(b);
                    } catch (FileNotFoundException unused2) {
                        return a.f1174p;
                    }
                }
                c0041a = new C0041a(this, fileOutputStream, null);
            }
            return c0041a;
        }

        public void a() {
            a.this.a(this, false);
        }

        public void b() {
            if (this.c) {
                a.this.a(this, false);
                a.this.d(this.a.a);
            } else {
                a.this.a(this, true);
            }
            this.f1186d = true;
        }
    }

    private final class d {
        private final String a;
        private final long[] b;
        private boolean c;

        private c f1188d;

        private long f1189e;

        private d(String str) {
            this.a = str;
            this.b = new long[a.this.f1178g];
        }

        d(a aVar, String str, CallableC0040a callableC0040a) {
            this(str);
        }

        private IOException a(String[] strArr) {
            throw new IOException("unexpected journal line: " + Arrays.toString(strArr));
        }

        public void b(String[] strArr) {
            if (strArr.length != a.this.f1178g) {
                throw a(strArr);
            }
            for (int i2 = 0; i2 < strArr.length; i2++) {
                try {
                    this.b[i2] = Long.parseLong(strArr[i2]);
                } catch (NumberFormatException unused) {
                    throw a(strArr);
                }
            }
        }

        public File a(int i2) {
            return new File(a.this.a, this.a + Operators.DOT_STR + i2);
        }

        public String a() {
            StringBuilder sb = new StringBuilder();
            for (long j2 : this.b) {
                sb.append(' ').append(j2);
            }
            return sb.toString();
        }

        public File b(int i2) {
            return new File(a.this.a, this.a + Operators.DOT_STR + i2 + ".tmp");
        }
    }

    public final class e implements Closeable {
        private final String a;
        private final long b;
        private final InputStream[] c;

        private final long[] f1191d;

        private e(String str, long j2, InputStream[] inputStreamArr, long[] jArr) {
            this.a = str;
            this.b = j2;
            this.c = inputStreamArr;
            this.f1191d = jArr;
        }

        e(a aVar, String str, long j2, InputStream[] inputStreamArr, long[] jArr, CallableC0040a callableC0040a) {
            this(str, j2, inputStreamArr, jArr);
        }

        public InputStream a(int i2) {
            return this.c[i2];
        }

        public String b(int i2) {
            return a.b(a(i2));
        }

        @Override
        public void close() {
            for (InputStream inputStream : this.c) {
                h0.c.a(inputStream);
            }
        }
    }

    private a(File file, int i2, int i3, long j2) {
        this.a = file;
        this.f1176e = i2;
        this.b = new File(file, "journal");
        this.c = new File(file, "journal.tmp");
        this.f1175d = new File(file, "journal.bkp");
        this.f1178g = i3;
        this.f1177f = j2;
    }

    private synchronized c a(String str, long j2) {
        b();
        e(str);
        d dVar = (d) this.f1181j.get(str);
        CallableC0040a callableC0040a = null;
        if (j2 != -1 && (dVar == null || dVar.f1189e != j2)) {
            return null;
        }
        if (dVar == null) {
            dVar = new d(this, str, callableC0040a);
            this.f1181j.put(str, dVar);
        } else if (dVar.f1188d != null) {
            return null;
        }
        c cVar = new c(this, dVar, callableC0040a);
        dVar.f1188d = cVar;
        this.f1180i.write("DIRTY " + str + '\n');
        this.f1180i.flush();
        return cVar;
    }

    public static a a(File file, int i2, int i3, long j2) {
        if (j2 <= 0) {
            throw new IllegalArgumentException("maxSize <= 0");
        }
        if (i3 <= 0) {
            throw new IllegalArgumentException("valueCount <= 0");
        }
        File file2 = new File(file, "journal.bkp");
        if (file2.exists()) {
            File file3 = new File(file, "journal");
            if (file3.exists()) {
                file2.delete();
            } else {
                a(file2, file3, false);
            }
        }
        a aVar = new a(file, i2, i3, j2);
        if (aVar.b.exists()) {
            try {
                aVar.f();
                aVar.e();
                aVar.f1180i = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(aVar.b, true), h0.c.a));
                return aVar;
            } catch (IOException e2) {
                System.out.println("DiskLruCache " + file + " is corrupt: " + e2.getMessage() + ", removing");
                aVar.c();
            }
        }
        file.mkdirs();
        a aVar2 = new a(file, i2, i3, j2);
        aVar2.g();
        return aVar2;
    }

    public synchronized void a(c cVar, boolean z2) {
        d dVar = cVar.a;
        if (dVar.f1188d != cVar) {
            throw new IllegalStateException();
        }
        if (z2 && !dVar.c) {
            for (int i2 = 0; i2 < this.f1178g; i2++) {
                if (!cVar.b[i2]) {
                    cVar.a();
                    throw new IllegalStateException("Newly created entry didn't create value for index " + i2);
                }
                if (!dVar.b(i2).exists()) {
                    cVar.a();
                    return;
                }
            }
        }
        for (int i3 = 0; i3 < this.f1178g; i3++) {
            File b2 = dVar.b(i3);
            if (!z2) {
                a(b2);
            } else if (b2.exists()) {
                File a = dVar.a(i3);
                b2.renameTo(a);
                long j2 = dVar.b[i3];
                long length = a.length();
                dVar.b[i3] = length;
                this.f1179h = (this.f1179h - j2) + length;
            }
        }
        this.f1182k++;
        dVar.f1188d = null;
        if (dVar.c || z2) {
            dVar.c = true;
            this.f1180i.write("CLEAN " + dVar.a + dVar.a() + '\n');
            if (z2) {
                long j3 = this.f1183l;
                this.f1183l = 1 + j3;
                dVar.f1189e = j3;
            }
        } else {
            this.f1181j.remove(dVar.a);
            this.f1180i.write("REMOVE " + dVar.a + '\n');
        }
        this.f1180i.flush();
        if (this.f1179h > this.f1177f || d()) {
            this.f1184m.submit(this.f1185n);
        }
    }

    private static void a(File file) {
        if (file.exists() && !file.delete()) {
            throw new IOException();
        }
    }

    private static void a(File file, File file2, boolean z2) {
        if (z2) {
            a(file2);
        }
        if (!file.renameTo(file2)) {
            throw new IOException();
        }
    }

    public static String b(InputStream inputStream) {
        return h0.c.a((Reader) new InputStreamReader(inputStream, h0.c.b));
    }

    private void b() {
        if (this.f1180i == null) {
            throw new IllegalStateException("cache is closed");
        }
    }

    private void c(String str) {
        String substring;
        int indexOf = str.indexOf(32);
        if (indexOf == -1) {
            throw new IOException("unexpected journal line: " + str);
        }
        int i2 = indexOf + 1;
        int indexOf2 = str.indexOf(32, i2);
        if (indexOf2 == -1) {
            substring = str.substring(i2);
            if (indexOf == 6 && str.startsWith("REMOVE")) {
                this.f1181j.remove(substring);
                return;
            }
        } else {
            substring = str.substring(i2, indexOf2);
        }
        d dVar = (d) this.f1181j.get(substring);
        CallableC0040a callableC0040a = null;
        if (dVar == null) {
            dVar = new d(this, substring, callableC0040a);
            this.f1181j.put(substring, dVar);
        }
        if (indexOf2 != -1 && indexOf == 5 && str.startsWith("CLEAN")) {
            String[] split = str.substring(indexOf2 + 1).split(Operators.SPACE_STR);
            dVar.c = true;
            dVar.f1188d = null;
            dVar.b(split);
            return;
        }
        if (indexOf2 == -1 && indexOf == 5 && str.startsWith("DIRTY")) {
            dVar.f1188d = new c(this, dVar, callableC0040a);
        } else if (indexOf2 != -1 || indexOf != 4 || !str.startsWith("READ")) {
            throw new IOException("unexpected journal line: " + str);
        }
    }

    public boolean d() {
        int i2 = this.f1182k;
        return i2 >= 2000 && i2 >= this.f1181j.size();
    }

    private void e() {
        a(this.c);
        Iterator it = this.f1181j.values().iterator();
        while (it.hasNext()) {
            d dVar = (d) it.next();
            int i2 = 0;
            if (dVar.f1188d == null) {
                while (i2 < this.f1178g) {
                    this.f1179h += dVar.b[i2];
                    i2++;
                }
            } else {
                dVar.f1188d = null;
                while (i2 < this.f1178g) {
                    a(dVar.a(i2));
                    a(dVar.b(i2));
                    i2++;
                }
                it.remove();
            }
        }
    }

    private void e(String str) {
        if (!f1173o.matcher(str).matches()) {
            throw new IllegalArgumentException("keys must match regex [a-z0-9_-]{1,64}: \"" + str + JSUtil.QUOTE);
        }
    }

    private void f() {
        h0.b bVar = new h0.b(new FileInputStream(this.b), h0.c.a);
        try {
            String b2 = bVar.b();
            String b3 = bVar.b();
            String b4 = bVar.b();
            String b5 = bVar.b();
            String b6 = bVar.b();
            if (!"libcore.io.DiskLruCache".equals(b2) || !SdkVersion.MINI_VERSION.equals(b3) || !Integer.toString(this.f1176e).equals(b4) || !Integer.toString(this.f1178g).equals(b5) || !"".equals(b6)) {
                throw new IOException("unexpected journal header: [" + b2 + ", " + b3 + ", " + b5 + ", " + b6 + Operators.ARRAY_END_STR);
            }
            int i2 = 0;
            while (true) {
                try {
                    c(bVar.b());
                    i2++;
                } catch (EOFException unused) {
                    this.f1182k = i2 - this.f1181j.size();
                    h0.c.a(bVar);
                    return;
                }
            }
        } catch (Throwable th) {
            h0.c.a(bVar);
            throw th;
        }
    }

    public synchronized void g() {
        Writer writer = this.f1180i;
        if (writer != null) {
            writer.close();
        }
        BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(this.c), h0.c.a));
        try {
            bufferedWriter.write("libcore.io.DiskLruCache");
            bufferedWriter.write(UMCustomLogInfoBuilder.LINE_SEP);
            bufferedWriter.write(SdkVersion.MINI_VERSION);
            bufferedWriter.write(UMCustomLogInfoBuilder.LINE_SEP);
            bufferedWriter.write(Integer.toString(this.f1176e));
            bufferedWriter.write(UMCustomLogInfoBuilder.LINE_SEP);
            bufferedWriter.write(Integer.toString(this.f1178g));
            bufferedWriter.write(UMCustomLogInfoBuilder.LINE_SEP);
            bufferedWriter.write(UMCustomLogInfoBuilder.LINE_SEP);
            for (d dVar : this.f1181j.values()) {
                if (dVar.f1188d != null) {
                    bufferedWriter.write("DIRTY " + dVar.a + '\n');
                } else {
                    bufferedWriter.write("CLEAN " + dVar.a + dVar.a() + '\n');
                }
            }
            bufferedWriter.close();
            if (this.b.exists()) {
                a(this.b, this.f1175d, true);
            }
            a(this.c, this.b, false);
            this.f1175d.delete();
            this.f1180i = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(this.b, true), h0.c.a));
        } catch (Throwable th) {
            bufferedWriter.close();
            throw th;
        }
    }

    public void h() {
        while (this.f1179h > this.f1177f) {
            d((String) ((Map.Entry) this.f1181j.entrySet().iterator().next()).getKey());
        }
    }

    public c a(String str) {
        return a(str, -1L);
    }

    public synchronized e b(String str) {
        Throwable th;
        InputStream inputStream;
        try {
            try {
                b();
                e(str);
                d dVar = (d) this.f1181j.get(str);
                if (dVar == null) {
                    return null;
                }
                if (!dVar.c) {
                    return null;
                }
                InputStream[] inputStreamArr = new InputStream[this.f1178g];
                for (int i2 = 0; i2 < this.f1178g; i2++) {
                    try {
                        try {
                            inputStreamArr[i2] = new FileInputStream(dVar.a(i2));
                        } catch (Throwable th2) {
                            th = th2;
                            throw th;
                        }
                    } catch (FileNotFoundException unused) {
                        for (int i3 = 0; i3 < this.f1178g && (inputStream = inputStreamArr[i3]) != null; i3++) {
                            h0.c.a(inputStream);
                        }
                        return null;
                    }
                }
                this.f1182k++;
                this.f1180i.append((CharSequence) ("READ " + str + '\n'));
                if (d()) {
                    this.f1184m.submit(this.f1185n);
                }
                return new e(this, str, dVar.f1189e, inputStreamArr, dVar.b, null);
            } catch (Throwable th3) {
                th = th3;
                th = th;
                throw th;
            }
        } catch (Throwable th4) {
            th = th4;
            th = th;
            throw th;
        }
    }

    public void c() {
        close();
        h0.c.a(this.a);
    }

    @Override
    public synchronized void close() {
        if (this.f1180i == null) {
            return;
        }
        Iterator it = new ArrayList(this.f1181j.values()).iterator();
        while (it.hasNext()) {
            d dVar = (d) it.next();
            if (dVar.f1188d != null) {
                dVar.f1188d.a();
            }
        }
        h();
        this.f1180i.close();
        this.f1180i = null;
    }

    public synchronized boolean d(String str) {
        b();
        e(str);
        d dVar = (d) this.f1181j.get(str);
        if (dVar != null && dVar.f1188d == null) {
            for (int i2 = 0; i2 < this.f1178g; i2++) {
                File a = dVar.a(i2);
                if (a.exists() && !a.delete()) {
                    throw new IOException("failed to delete " + a);
                }
                this.f1179h -= dVar.b[i2];
                dVar.b[i2] = 0;
            }
            this.f1182k++;
            this.f1180i.append((CharSequence) ("REMOVE " + str + '\n'));
            this.f1181j.remove(str);
            if (d()) {
                this.f1184m.submit(this.f1185n);
            }
            return true;
        }
        return false;
    }

    public synchronized void flush() {
        b();
        h();
        this.f1180i.flush();
    }
}