package com.google.android.libraries.places.internal; import com.google.common.primitives.UnsignedBytes; import java.io.IOException; import java.math.RoundingMode; /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes2.dex */ public class zzmi extends zzmj { final zzmf zzb; final Character zzc; /* JADX INFO: Access modifiers changed from: package-private */ public zzmi(zzmf zzmfVar, Character ch) { this.zzb = zzmfVar; if (ch != null && zzmfVar.zzb(ch.charValue())) { throw new IllegalArgumentException(zzil.zza("Padding character %s was already in alphabet", ch)); } this.zzc = ch; } public final boolean equals(Object obj) { if (!(obj instanceof zzmi)) { return false; } zzmi zzmiVar = (zzmi) obj; if (!this.zzb.equals(zzmiVar.zzb)) { return false; } Character ch = this.zzc; Character ch2 = zzmiVar.zzc; if (ch != ch2) { return ch != null && ch.equals(ch2); } return true; } public final int hashCode() { int hashCode = this.zzb.hashCode(); Character ch = this.zzc; return hashCode ^ (ch == null ? 0 : ch.hashCode()); } public final String toString() { StringBuilder sb = new StringBuilder("BaseEncoding."); sb.append(this.zzb); if (8 % this.zzb.zzb != 0) { if (this.zzc == null) { sb.append(".omitPadding()"); } else { sb.append(".withPadChar('"); sb.append(this.zzc); sb.append("')"); } } return sb.toString(); } @Override // com.google.android.libraries.places.internal.zzmj void zza(Appendable appendable, byte[] bArr, int i, int i2) throws IOException { int i3 = 0; zzig.zzg(0, i2, bArr.length); while (i3 < i2) { zzc(appendable, bArr, i3, Math.min(this.zzb.zzd, i2 - i3)); i3 += this.zzb.zzd; } } @Override // com.google.android.libraries.places.internal.zzmj final int zzb(int i) { zzmf zzmfVar = this.zzb; return zzmfVar.zzc * zzacl.zza(i, zzmfVar.zzd, RoundingMode.CEILING); } /* JADX INFO: Access modifiers changed from: package-private */ public final void zzc(Appendable appendable, byte[] bArr, int i, int i2) throws IOException { zzig.zzg(i, i + i2, bArr.length); int i3 = 0; zzig.zzd(i2 <= this.zzb.zzd); long j = 0; for (int i4 = 0; i4 < i2; i4++) { j = (j | (bArr[i + i4] & UnsignedBytes.MAX_VALUE)) << 8; } int i5 = this.zzb.zzb; while (i3 < (i2 << 3)) { zzmf zzmfVar = this.zzb; appendable.append(zzmfVar.zza(zzmfVar.zza & ((int) (j >>> ((((i2 + 1) << 3) - i5) - i3))))); i3 += this.zzb.zzb; } if (this.zzc != null) { while (i3 < (this.zzb.zzd << 3)) { appendable.append(this.zzc.charValue()); i3 += this.zzb.zzb; } } } /* JADX INFO: Access modifiers changed from: package-private */ public zzmi(String str, String str2, Character ch) { this(new zzmf(str, str2.toCharArray()), ch); } }