package org.bouncycastle.asn1; import java.io.IOException; import java.util.Enumeration; /* loaded from: classes6.dex */ public class DLSequence extends ASN1Sequence { private int bodyLength; /* JADX INFO: Access modifiers changed from: package-private */ @Override // org.bouncycastle.asn1.ASN1Primitive public int encodedLength() throws IOException { int bodyLength = getBodyLength(); return StreamUtil.calculateBodyLength(bodyLength) + 1 + bodyLength; } /* JADX INFO: Access modifiers changed from: package-private */ @Override // org.bouncycastle.asn1.ASN1Sequence, org.bouncycastle.asn1.ASN1Primitive public void encode(ASN1OutputStream aSN1OutputStream) throws IOException { ASN1OutputStream dLSubStream = aSN1OutputStream.getDLSubStream(); int bodyLength = getBodyLength(); aSN1OutputStream.write(48); aSN1OutputStream.writeLength(bodyLength); Enumeration objects = getObjects(); while (objects.hasMoreElements()) { dLSubStream.writeObject((ASN1Encodable) objects.nextElement()); } } private int getBodyLength() throws IOException { if (this.bodyLength < 0) { Enumeration objects = getObjects(); int i = 0; while (objects.hasMoreElements()) { i += ((ASN1Encodable) objects.nextElement()).toASN1Primitive().toDLObject().encodedLength(); } this.bodyLength = i; } return this.bodyLength; } public DLSequence(ASN1Encodable[] aSN1EncodableArr) { super(aSN1EncodableArr); this.bodyLength = -1; } public DLSequence(ASN1EncodableVector aSN1EncodableVector) { super(aSN1EncodableVector); this.bodyLength = -1; } public DLSequence(ASN1Encodable aSN1Encodable) { super(aSN1Encodable); this.bodyLength = -1; } public DLSequence() { this.bodyLength = -1; } }