package com.google.firebase.firestore.index; import com.google.firebase.firestore.model.FieldIndex; import o.QwV; /* loaded from: classes2.dex */ public class IndexByteEncoder { private final OrderedCodeWriter orderedCode = new OrderedCodeWriter(); private final AscendingIndexByteEncoder ascending = new AscendingIndexByteEncoder(this); private final DescendingIndexByteEncoder descending = new DescendingIndexByteEncoder(this); /* loaded from: classes2.dex */ class AscendingIndexByteEncoder extends DirectionalIndexByteEncoder { final IndexByteEncoder this$0; AscendingIndexByteEncoder(IndexByteEncoder indexByteEncoder) { this.this$0 = indexByteEncoder; } @Override // com.google.firebase.firestore.index.DirectionalIndexByteEncoder public void writeBytes(QwV qwV) { this.this$0.orderedCode.writeBytesAscending(qwV); } @Override // com.google.firebase.firestore.index.DirectionalIndexByteEncoder public void writeString(String str) { this.this$0.orderedCode.writeUtf8Ascending(str); } @Override // com.google.firebase.firestore.index.DirectionalIndexByteEncoder public void writeLong(long j) { this.this$0.orderedCode.writeSignedLongAscending(j); } @Override // com.google.firebase.firestore.index.DirectionalIndexByteEncoder public void writeDouble(double d) { this.this$0.orderedCode.writeDoubleAscending(d); } @Override // com.google.firebase.firestore.index.DirectionalIndexByteEncoder public void writeInfinity() { this.this$0.orderedCode.writeInfinityAscending(); } } /* loaded from: classes2.dex */ class DescendingIndexByteEncoder extends DirectionalIndexByteEncoder { final IndexByteEncoder this$0; DescendingIndexByteEncoder(IndexByteEncoder indexByteEncoder) { this.this$0 = indexByteEncoder; } @Override // com.google.firebase.firestore.index.DirectionalIndexByteEncoder public void writeBytes(QwV qwV) { this.this$0.orderedCode.writeBytesDescending(qwV); } @Override // com.google.firebase.firestore.index.DirectionalIndexByteEncoder public void writeString(String str) { this.this$0.orderedCode.writeUtf8Descending(str); } @Override // com.google.firebase.firestore.index.DirectionalIndexByteEncoder public void writeLong(long j) { this.this$0.orderedCode.writeSignedLongDescending(j); } @Override // com.google.firebase.firestore.index.DirectionalIndexByteEncoder public void writeDouble(double d) { this.this$0.orderedCode.writeDoubleDescending(d); } @Override // com.google.firebase.firestore.index.DirectionalIndexByteEncoder public void writeInfinity() { this.this$0.orderedCode.writeInfinityDescending(); } } public void seed(byte[] bArr) { this.orderedCode.seed(bArr); } public DirectionalIndexByteEncoder forKind(FieldIndex.Segment.Kind kind) { return kind.equals(FieldIndex.Segment.Kind.DESCENDING) ? this.descending : this.ascending; } public byte[] getEncodedBytes() { return this.orderedCode.encodedBytes(); } }