package defpackage;

import j$.util.Objects;
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.Locale;

/* JADX INFO: renamed from: ᵯⁱᵳﾞ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public final class C4337 implements InterfaceC3441 {

    /* JADX INFO: renamed from: ᵔᵖᵹᵫ, reason: contains not printable characters */
    public static final Charset f16518 = Charset.forName("UTF-8");

    /* JADX INFO: renamed from: ˌᴵ, reason: contains not printable characters */
    public final File f16519;

    /* JADX INFO: renamed from: ᵜᵪʾ, reason: contains not printable characters */
    public C4155 f16520;

    public C4337(File file) {
        this.f16519 = file;
    }

    /* JADX WARN: Removed duplicated region for block: B:4:0x000a  */
    @Override // defpackage.InterfaceC3441
    /* JADX INFO: renamed from: ːˏᵟᵯ */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final String mo7855() {
        C1544 c1544;
        byte[] bArr;
        File file = this.f16519;
        if (file.exists()) {
            if (this.f16520 == null) {
                try {
                    this.f16520 = new C4155(file);
                } catch (IOException unused) {
                    Objects.toString(file);
                }
            }
            C4155 c4155 = this.f16520;
            if (c4155 == null) {
                c1544 = null;
            } else {
                int[] iArr = {0};
                byte[] bArr2 = new byte[c4155.m9079()];
                try {
                    this.f16520.m9080(new C3714(bArr2, 16, iArr));
                } catch (IOException unused2) {
                }
                c1544 = new C1544(iArr[0], bArr2);
            }
        }
        if (c1544 == null) {
            bArr = null;
        } else {
            int i = c1544.f6212;
            bArr = new byte[i];
            System.arraycopy(c1544.f6213, 0, bArr, 0, i);
        }
        if (bArr != null) {
            return new String(bArr, f16518);
        }
        return null;
    }

    @Override // defpackage.InterfaceC3441
    /* JADX INFO: renamed from: ᵲᵶᵳˈ */
    public final void mo7856() {
        ᵥˇᵛˎ.ᵻˈᵦʼ(this.f16520);
        this.f16520 = null;
    }

    @Override // defpackage.InterfaceC3441
    /* JADX INFO: renamed from: ᵷᵺʾᵖ */
    public final void mo7857(long j, String str) {
        File file = this.f16519;
        if (this.f16520 == null) {
            try {
                this.f16520 = new C4155(file);
            } catch (IOException unused) {
                Objects.toString(file);
            }
        }
        if (this.f16520 == null) {
            return;
        }
        try {
            if (str.length() > 16384) {
                str = "...".concat(str.substring(str.length() - 16384));
            }
            this.f16520.m9081(String.format(Locale.US, "%d %s%n", Long.valueOf(j), str.replaceAll("\r", " ").replaceAll("\n", " ")).getBytes(f16518));
            while (!this.f16520.m9074() && this.f16520.m9079() > 65536) {
                this.f16520.m9082();
            }
        } catch (IOException unused2) {
        }
    }
}
