package androidx.fragment.app;

import android.util.Log;
import java.io.Writer;

/* renamed from: androidx.fragment.app.p0 */
/* loaded from: classes.dex */
public final class C0358p0 extends Writer {

    /* renamed from: d */
    public final String f1447d;

    /* renamed from: e */
    public StringBuilder f1448e = new StringBuilder(128);

    public C0358p0(String str) {
        this.f1447d = str;
    }

    /* renamed from: a */
    public final void m3877a() {
        if (this.f1448e.length() > 0) {
            Log.d(this.f1447d, this.f1448e.toString());
            StringBuilder sb = this.f1448e;
            sb.delete(0, sb.length());
        }
    }

    @Override // java.io.Writer, java.io.Closeable, java.lang.AutoCloseable
    public void close() {
        m3877a();
    }

    @Override // java.io.Writer, java.io.Flushable
    public void flush() {
        m3877a();
    }

    @Override // java.io.Writer
    public void write(char[] cArr, int i, int i2) {
        for (int i3 = 0; i3 < i2; i3++) {
            char c = cArr[i + i3];
            if (c == '\n') {
                m3877a();
            } else {
                this.f1448e.append(c);
            }
        }
    }
}