package j$.time.chrono;

import j$.time.LocalDate;
import j$.time.ZoneId;
import j$.time.ZoneOffset;
import java.io.Externalizable;
import java.io.IOException;
import java.io.InvalidClassException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.io.StreamCorruptedException;

/* JADX INFO: loaded from: classes2.dex */
final class D implements Externalizable {
    private static final long serialVersionUID = -6103370247208168577L;

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    private byte f19131a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    private Object f19132b;

    public D() {
    }

    D(byte b5, Object obj) {
        this.f19131a = b5;
        this.f19132b = obj;
    }

    @Override // java.io.Externalizable
    public final void writeExternal(ObjectOutput objectOutput) throws IOException {
        byte b5 = this.f19131a;
        Object obj = this.f19132b;
        objectOutput.writeByte(b5);
        switch (b5) {
            case 1:
                objectOutput.writeUTF(((AbstractC2282a) obj).s());
                return;
            case 2:
                ((C2287f) obj).writeExternal(objectOutput);
                return;
            case 3:
                ((j) obj).writeExternal(objectOutput);
                return;
            case 4:
                w wVar = (w) obj;
                wVar.getClass();
                objectOutput.writeInt(wVar.j(j$.time.temporal.a.YEAR));
                objectOutput.writeByte(wVar.j(j$.time.temporal.a.MONTH_OF_YEAR));
                objectOutput.writeByte(wVar.j(j$.time.temporal.a.DAY_OF_MONTH));
                return;
            case 5:
                ((x) obj).B(objectOutput);
                return;
            case 6:
                ((p) obj).writeExternal(objectOutput);
                return;
            case 7:
                B b6 = (B) obj;
                b6.getClass();
                objectOutput.writeInt(b6.j(j$.time.temporal.a.YEAR));
                objectOutput.writeByte(b6.j(j$.time.temporal.a.MONTH_OF_YEAR));
                objectOutput.writeByte(b6.j(j$.time.temporal.a.DAY_OF_MONTH));
                return;
            case 8:
                H h5 = (H) obj;
                h5.getClass();
                objectOutput.writeInt(h5.j(j$.time.temporal.a.YEAR));
                objectOutput.writeByte(h5.j(j$.time.temporal.a.MONTH_OF_YEAR));
                objectOutput.writeByte(h5.j(j$.time.temporal.a.DAY_OF_MONTH));
                return;
            case 9:
                ((C2288g) obj).writeExternal(objectOutput);
                return;
            default:
                throw new InvalidClassException("Unknown serialized type");
        }
    }

    @Override // java.io.Externalizable
    public final void readExternal(ObjectInput objectInput) throws IOException {
        Object objR;
        byte b5 = objectInput.readByte();
        this.f19131a = b5;
        switch (b5) {
            case 1:
                int i6 = AbstractC2282a.f19140c;
                objR = AbstractC2282a.r(objectInput.readUTF());
                break;
            case 2:
                objR = ((ChronoLocalDate) objectInput.readObject()).L((j$.time.l) objectInput.readObject());
                break;
            case 3:
                objR = ((InterfaceC2285d) objectInput.readObject()).H((ZoneOffset) objectInput.readObject()).I((ZoneId) objectInput.readObject());
                break;
            case 4:
                LocalDate localDate = w.f19176d;
                int i7 = objectInput.readInt();
                byte b6 = objectInput.readByte();
                byte b7 = objectInput.readByte();
                u.f19174d.getClass();
                objR = new w(LocalDate.h0(i7, b6, b7));
                break;
            case 5:
                x xVar = x.f19180d;
                objR = x.v(objectInput.readByte());
                break;
            case 6:
                n nVar = (n) objectInput.readObject();
                int i8 = objectInput.readInt();
                byte b8 = objectInput.readByte();
                byte b9 = objectInput.readByte();
                nVar.getClass();
                objR = p.Y(nVar, i8, b8, b9);
                break;
            case 7:
                int i9 = objectInput.readInt();
                byte b10 = objectInput.readByte();
                byte b11 = objectInput.readByte();
                z.f19186d.getClass();
                objR = new B(LocalDate.h0(i9 + 1911, b10, b11));
                break;
            case 8:
                int i10 = objectInput.readInt();
                byte b12 = objectInput.readByte();
                byte b13 = objectInput.readByte();
                F.f19134d.getClass();
                objR = new H(LocalDate.h0(i10 - 543, b12, b13));
                break;
            case 9:
                int i11 = C2288g.f19145e;
                objR = new C2288g(AbstractC2282a.r(objectInput.readUTF()), objectInput.readInt(), objectInput.readInt(), objectInput.readInt());
                break;
            default:
                throw new StreamCorruptedException("Unknown serialized type");
        }
        this.f19132b = objR;
    }

    private Object readResolve() {
        return this.f19132b;
    }
}
