package o; import com.google.common.primitives.UnsignedBytes; import java.io.IOException; import java.util.Collections; import java.util.Iterator; import o.LnT; /* loaded from: classes.dex */ public final class OJg implements yYF { @Override // o.yYF public final Iterable c() { return Collections.singletonList(EnumC2874amo.DHT); } @Override // o.yYF public final void d(Iterable iterable, C16613piz c16613piz, EnumC2874amo enumC2874amo) { Iterator it = iterable.iterator(); while (it.hasNext()) { C0629LEh c0629LEh = new C0629LEh(it.next()); LnT lnT = (LnT) c16613piz.c(LnT.class); if (lnT == null) { lnT = new LnT(); c16613piz.c.add(lnT); } while (c0629LEh.d() > 0) { try { byte b = c0629LEh.b(); LnT.RVV.HBt d = LnT.RVV.HBt.d((b & 240) >> 4); byte[] d2 = d(c0629LEh, 16); int i = 0; for (byte b2 : d2) { i += b2 & UnsignedBytes.MAX_VALUE; } lnT.a.add(new LnT.RVV(d, b & 15, d2, d(c0629LEh, i))); } catch (IOException e) { BrP.b(new Object[]{lnT, e.getMessage()}, -1786863991, 1786863992, System.identityHashCode(lnT)); } } lnT.d(1, lnT.a.size()); } } private static byte[] d(Eaa eaa, int i) throws IOException { byte b; byte[] bArr = new byte[i]; for (int i2 = 0; i2 < i; i2++) { byte b2 = eaa.b(); if ((b2 & UnsignedBytes.MAX_VALUE) == 255 && (b = eaa.b()) != 0) { StringBuilder sb = new StringBuilder("Marker "); sb.append(EnumC2874amo.a(b)); sb.append(" found inside DHT segment"); throw new IOException(sb.toString()); } bArr[i2] = b2; } return bArr; } }