59 lines
1.9 KiB
Java
59 lines
1.9 KiB
Java
package o;
|
|
|
|
import com.drew.imaging.png.PngProcessingException;
|
|
import com.google.common.base.Ascii;
|
|
import java.io.IOException;
|
|
import java.util.ArrayList;
|
|
import java.util.Arrays;
|
|
import java.util.HashSet;
|
|
import java.util.Set;
|
|
|
|
/* loaded from: classes.dex */
|
|
public final class VFt {
|
|
private static final byte[] e = {-119, 80, 78, 71, 13, 10, Ascii.SUB, 10};
|
|
|
|
public static Iterable<xIZ> b(Eaa eaa, Set<nFt> set) throws PngProcessingException, IOException {
|
|
byte[] bArr;
|
|
eaa.e = true;
|
|
byte[] bArr2 = e;
|
|
if (!Arrays.equals(bArr2, eaa.a(bArr2.length))) {
|
|
throw new PngProcessingException("PNG signature mismatch");
|
|
}
|
|
ArrayList arrayList = new ArrayList();
|
|
HashSet hashSet = new HashSet();
|
|
boolean z = false;
|
|
boolean z2 = false;
|
|
while (!z) {
|
|
int a = eaa.a();
|
|
if (a < 0) {
|
|
throw new PngProcessingException("PNG chunk length exceeds maximum");
|
|
}
|
|
nFt nft = new nFt(eaa.a(4));
|
|
boolean z3 = set == null || set.contains(nft);
|
|
if (z3) {
|
|
bArr = eaa.a(a);
|
|
} else {
|
|
eaa.b(a);
|
|
bArr = null;
|
|
}
|
|
eaa.b(4L);
|
|
if (z3 && hashSet.contains(nft) && !nft.q) {
|
|
throw new PngProcessingException(String.format("Observed multiple instances of PNG chunk '%s', for which multiples are not allowed", nft));
|
|
}
|
|
if (nft.equals(nFt.b)) {
|
|
z2 = true;
|
|
} else if (!z2) {
|
|
throw new PngProcessingException(String.format("First chunk should be '%s', but '%s' was observed", nFt.b, nft));
|
|
}
|
|
if (nft.equals(nFt.c)) {
|
|
z = true;
|
|
}
|
|
if (z3) {
|
|
arrayList.add(new xIZ(nft, bArr));
|
|
}
|
|
hashSet.add(nft);
|
|
}
|
|
return arrayList;
|
|
}
|
|
}
|