package o; import com.google.common.base.Ascii; import com.google.common.primitives.UnsignedBytes; import java.io.IOException; import java.io.UnsupportedEncodingException; import org.bouncycastle.crypto.tls.CipherSuite; /* loaded from: classes.dex */ public abstract class Eaa { public boolean e = true; public abstract byte[] a(int i) throws IOException; public abstract byte b() throws IOException; public abstract void b(long j) throws IOException; public abstract long c() throws IOException; public abstract void c(byte[] bArr, int i, int i2) throws IOException; public abstract int d(); public abstract boolean d(long j) throws IOException; public final int h() throws IOException { int b; int b2; if (this.e) { b = (b() << 8) & CipherSuite.DRAFT_TLS_DHE_RSA_WITH_AES_128_OCB; b2 = b() & UnsignedBytes.MAX_VALUE; } else { b = b() & UnsignedBytes.MAX_VALUE; b2 = 65280 & (b() << 8); } return b | b2; } public final short e() throws IOException { int b; int b2; if (this.e) { b = (b() << 8) & (-256); b2 = b() & 255; } else { b = b() & 255; b2 = (b() << 8) & (-256); } return (short) (b | b2); } public final long f() throws IOException { if (this.e) { long b = b(); return ((b() << 16) & 16711680) | (4278190080L & (b << 24)) | ((b() << 8) & 65280) | (b() & 255); } return (b() & 255) | ((b() << 8) & 65280) | ((b() << 16) & 16711680) | ((b() << 24) & 4278190080L); } public final int a() throws IOException { int b; int b2; if (this.e) { b = ((b() << Ascii.CAN) & (-16777216)) | ((b() << 16) & 16711680) | ((b() << 8) & CipherSuite.DRAFT_TLS_DHE_RSA_WITH_AES_128_OCB); b2 = b() & UnsignedBytes.MAX_VALUE; } else { b = (b() & UnsignedBytes.MAX_VALUE) | (65280 & (b() << 8)) | (16711680 & (b() << 16)); b2 = (-16777216) & (b() << Ascii.CAN); } return b | b2; } public final long g() throws IOException { long b; long b2; if (this.e) { b = ((b() << 56) & (-72057594037927936L)) | ((b() << 48) & 71776119061217280L) | ((b() << 40) & 280375465082880L) | ((b() << 32) & 1095216660480L) | ((b() << 24) & 4278190080L) | ((b() << 16) & 16711680) | ((b() << 8) & 65280); b2 = b() & 255; } else { long b3 = b(); long b4 = b(); long b5 = b(); long b6 = b(); long b7 = (b() << 32) & 1095216660480L; b = b7 | (b3 & 255) | ((b4 << 8) & 65280) | ((b5 << 16) & 16711680) | ((b6 << 24) & 4278190080L) | ((b() << 40) & 280375465082880L) | ((b() << 48) & 71776119061217280L); b2 = (b() << 56) & (-72057594037927936L); } return b | b2; } public final String a(int i, String str) throws IOException { byte[] a = a(i); try { return new String(a, str); } catch (UnsupportedEncodingException unused) { return new String(a); } } public final byte[] c(int i) throws IOException { byte[] bArr = new byte[i]; int i2 = 0; while (i2 < i) { byte b = b(); bArr[i2] = b; if (b == 0) { break; } i2++; } if (i2 == i) { return bArr; } byte[] bArr2 = new byte[i2]; if (i2 > 0) { System.arraycopy(bArr, 0, bArr2, 0, i2); } return bArr2; } }