package p138.p176.p291.p296.p297.p305;

import java.io.File;
import java.io.FileOutputStream;
import java.io.FilenameFilter;
import java.io.IOException;
import p138.p139.p143.p144.C2803;

/* JADX INFO: renamed from: ދ.ހ.ށ.ބ.ށ.ތ.ؠ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public class C5831 extends FileOutputStream {

    /* JADX INFO: renamed from: ކ, reason: contains not printable characters */
    public static final FilenameFilter f16532 = new C5832();

    /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
    public final String f16533;

    /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
    public File f16534;

    /* JADX INFO: renamed from: ޅ, reason: contains not printable characters */
    public boolean f16535;

    /* JADX INFO: renamed from: ދ.ހ.ށ.ބ.ށ.ތ.ؠ$֏, reason: contains not printable characters */
    public class C5832 implements FilenameFilter {
        @Override // java.io.FilenameFilter
        public boolean accept(File file, String str) {
            return str.endsWith(".cls_temp");
        }
    }

    public C5831(File file, String str) {
        super(new File(file, C2803.m4879(str, ".cls_temp")));
        this.f16535 = false;
        StringBuilder sb = new StringBuilder();
        sb.append(file);
        this.f16533 = C2803.m4884(sb, File.separator, str);
        this.f16534 = new File(C2803.m4884(new StringBuilder(), this.f16533, ".cls_temp"));
    }

    @Override // java.io.FileOutputStream, java.io.OutputStream, java.io.Closeable, java.lang.AutoCloseable
    public synchronized void close() {
        if (this.f16535) {
            return;
        }
        this.f16535 = true;
        super.flush();
        super.close();
        File file = new File(this.f16533 + ".cls");
        if (this.f16534.renameTo(file)) {
            this.f16534 = null;
            return;
        }
        String str = "";
        if (file.exists()) {
            str = " (target already exists)";
        } else if (!this.f16534.exists()) {
            str = " (source does not exist)";
        }
        throw new IOException("Could not rename temp file: " + this.f16534 + " -> " + file + str);
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public void m9148() {
        if (this.f16535) {
            return;
        }
        this.f16535 = true;
        super.flush();
        super.close();
    }
}
