MD5 校验值:8005b9444b02324a81f85f1ef7e26f28
b.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。
package a1; import android.media.MediaDataSource; import android.media.MediaMetadataRetriever; import android.os.Build; import android.system.Os; import android.system.OsConstants; import android.util.Log; import android.util.Pair; import com.yalantis.ucrop.BuildConfig; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.ByteArrayInputStream; import java.io.Closeable; import java.io.DataInput; import java.io.DataInputStream; import java.io.EOFException; import java.io.File; import java.io.FileDescriptor; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.FilterOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.Serializable; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.charset.Charset; import java.text.SimpleDateFormat; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; public final class b { public static final e F; public static final e[][] G; public static final e[] H; public static final e I; public static final e J; public static final HashMap<Integer, e>[] K; public static final HashMap<String, e>[] L; public static final HashSet<String> M; public static final HashMap<Integer, Integer> N; public static final Charset O; public static final byte[] P; public static final byte[] Q; public static final Pattern R; public String f16a; public FileDescriptor f17b; public int f18c; public final HashMap<String, d>[] f19d; public HashSet f20e; public ByteOrder f21f; public boolean f22g; public int f23h; public int f24i; public byte[] j; public int f25k; public int f26l; public int f27m; public int f28n; public int f29o; public int f30p; public boolean f31q; public static final boolean f8r = Log.isLoggable("ExifInterface", 3); public static final List<Integer> f9s = Arrays.asList(1, 6, 3, 8); public static final List<Integer> f10t = Arrays.asList(2, 7, 4, 5); public static final int[] f11u = {8, 8, 8}; public static final int[] v = {8}; public static final byte[] f12w = {-1, -40, -1}; public static final byte[] f13x = {102, 116, 121, 112}; public static final byte[] f14y = {109, 105, 102, 49}; public static final byte[] f15z = {104, 101, 105, 99}; public static final byte[] A = {79, 76, 89, 77, 80, 0}; public static final byte[] B = {79, 76, 89, 77, 80, 85, 83, 0, 73, 73}; public static final String[] C = {BuildConfig.FLAVOR, "BYTE", "STRING", "USHORT", "ULONG", "URATIONAL", "SBYTE", "UNDEFINED", "SSHORT", "SLONG", "SRATIONAL", "SINGLE", "DOUBLE", "IFD"}; public static final int[] D = {0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8, 1}; public static final byte[] E = {65, 83, 67, 73, 73, 0, 0, 0}; public class a extends MediaDataSource { public long f32s; public final C0002b f33t; public a(C0002b c0002b) { this.f33t = c0002b; } @Override public final void close() throws IOException { } public final long getSize() throws IOException { return -1L; } public final int readAt(long j, byte[] bArr, int i10, int i11) throws IOException { if (i11 == 0) { return 0; } if (j < 0) { return -1; } try { long j10 = this.f32s; if (j10 != j) { if (j10 >= 0 && j >= j10 + this.f33t.available()) { return -1; } this.f33t.a(j); this.f32s = j; } if (i11 > this.f33t.available()) { i11 = this.f33t.available(); } int read = this.f33t.read(bArr, i10, i11); if (read >= 0) { this.f32s += read; return read; } } catch (IOException unused) { } this.f32s = -1L; return -1; } } public static class c extends FilterOutputStream { public final OutputStream f39s; public ByteOrder f40t; public c(BufferedOutputStream bufferedOutputStream, ByteOrder byteOrder) { super(bufferedOutputStream); this.f39s = bufferedOutputStream; this.f40t = byteOrder; } public final void a(int i10) throws IOException { this.f39s.write(i10); } public final void b(int i10) throws IOException { ByteOrder byteOrder = this.f40t; if (byteOrder == ByteOrder.LITTLE_ENDIAN) { this.f39s.write((i10 >>> 0) & 255); this.f39s.write((i10 >>> 8) & 255); this.f39s.write((i10 >>> 16) & 255); this.f39s.write((i10 >>> 24) & 255); return; } if (byteOrder == ByteOrder.BIG_ENDIAN) { this.f39s.write((i10 >>> 24) & 255); this.f39s.write((i10 >>> 16) & 255); this.f39s.write((i10 >>> 8) & 255); this.f39s.write((i10 >>> 0) & 255); } } public final void c(short s10) throws IOException { ByteOrder byteOrder = this.f40t; if (byteOrder == ByteOrder.LITTLE_ENDIAN) { this.f39s.write((s10 >>> 0) & 255); this.f39s.write((s10 >>> 8) & 255); } else if (byteOrder == ByteOrder.BIG_ENDIAN) { this.f39s.write((s10 >>> 8) & 255); this.f39s.write((s10 >>> 0) & 255); } } @Override public final void write(byte[] bArr) throws IOException { this.f39s.write(bArr); } @Override public final void write(byte[] bArr, int i10, int i11) throws IOException { this.f39s.write(bArr, i10, i11); } } public static class d { public final int f41a; public final int f42b; public final byte[] f43c; public d(byte[] bArr, int i10, int i11, int i12) { this.f41a = i10; this.f42b = i11; this.f43c = bArr; } public static d a(String str) { byte[] bytes = (str + (char) 0).getBytes(b.O); return new d(bytes, 2, bytes.length, 0); } public static d b(long j, ByteOrder byteOrder) { return c(new long[]{j}, byteOrder); } public static d c(long[] jArr, ByteOrder byteOrder) { ByteBuffer wrap = ByteBuffer.wrap(new byte[b.D[4] * jArr.length]); wrap.order(byteOrder); for (long j : jArr) { wrap.putInt((int) j); } return new d(wrap.array(), 4, jArr.length, 0); } public static d d(f[] fVarArr, ByteOrder byteOrder) { ByteBuffer wrap = ByteBuffer.wrap(new byte[b.D[5] * fVarArr.length]); wrap.order(byteOrder); for (f fVar : fVarArr) { wrap.putInt((int) fVar.f48a); wrap.putInt((int) fVar.f49b); } return new d(wrap.array(), 5, fVarArr.length, 0); } public static d e(int i10, ByteOrder byteOrder) { return f(new int[]{i10}, byteOrder); } public static d f(int[] iArr, ByteOrder byteOrder) { ByteBuffer wrap = ByteBuffer.wrap(new byte[b.D[3] * iArr.length]); wrap.order(byteOrder); for (int i10 : iArr) { wrap.putShort((short) i10); } return new d(wrap.array(), 3, iArr.length, 0); } public final double g(ByteOrder byteOrder) { Object j = j(byteOrder); if (j != null) { if (j instanceof String) { return Double.parseDouble((String) j); } if (j instanceof long[]) { if (((long[]) j).length == 1) { return r5[0]; } throw new NumberFormatException("There are more than one component"); } if (j instanceof int[]) { if (((int[]) j).length == 1) { return r5[0]; } throw new NumberFormatException("There are more than one component"); } if (j instanceof double[]) { double[] dArr = (double[]) j; if (dArr.length == 1) { return dArr[0]; } throw new NumberFormatException("There are more than one component"); } if (j instanceof f[]) { f[] fVarArr = (f[]) j; if (fVarArr.length == 1) { f fVar = fVarArr[0]; return fVar.f48a / fVar.f49b; } throw new NumberFormatException("There are more than one component"); } throw new NumberFormatException("Couldn't find a double value"); } throw new NumberFormatException("NULL can't be converted to a double value"); } public final int h(ByteOrder byteOrder) { Object j = j(byteOrder); if (j != null) { if (j instanceof String) { return Integer.parseInt((String) j); } if (j instanceof long[]) { long[] jArr = (long[]) j; if (jArr.length == 1) { return (int) jArr[0]; } throw new NumberFormatException("There are more than one component"); } if (j instanceof int[]) { int[] iArr = (int[]) j; if (iArr.length == 1) { return iArr[0]; } throw new NumberFormatException("There are more than one component"); } throw new NumberFormatException("Couldn't find a integer value"); } throw new NumberFormatException("NULL can't be converted to a integer value"); } public final String i(ByteOrder byteOrder) { Object j = j(byteOrder); if (j == null) { return null; } if (j instanceof String) { return (String) j; } StringBuilder sb2 = new StringBuilder(); int i10 = 0; if (j instanceof long[]) { long[] jArr = (long[]) j; while (i10 < jArr.length) { sb2.append(jArr[i10]); i10++; if (i10 != jArr.length) { sb2.append(","); } } return sb2.toString(); } if (j instanceof int[]) { int[] iArr = (int[]) j; while (i10 < iArr.length) { sb2.append(iArr[i10]); i10++; if (i10 != iArr.length) { sb2.append(","); } } return sb2.toString(); } if (j instanceof double[]) { double[] dArr = (double[]) j; while (i10 < dArr.length) { sb2.append(dArr[i10]); i10++; if (i10 != dArr.length) { sb2.append(","); } } return sb2.toString(); } if (!(j instanceof f[])) { return null; } f[] fVarArr = (f[]) j; while (i10 < fVarArr.length) { sb2.append(fVarArr[i10].f48a); sb2.append('/'); sb2.append(fVarArr[i10].f49b); i10++; if (i10 != fVarArr.length) { sb2.append(","); } } return sb2.toString(); } public final Serializable j(ByteOrder byteOrder) { C0002b c0002b; byte b10; byte b11; byte[] bArr; C0002b c0002b2 = null; try { c0002b = new C0002b(this.f43c); } catch (IOException unused) { c0002b = null; } catch (Throwable th) { th = th; } try { c0002b.f37t = byteOrder; int i10 = 0; boolean z10 = true; switch (this.f41a) { case 1: case 6: byte[] bArr2 = this.f43c; if (bArr2.length == 1 && (b10 = bArr2[0]) >= 0 && b10 <= 1) { String str = new String(new char[]{(char) (b10 + 48)}); try { c0002b.close(); } catch (IOException unused2) { } return str; } String str2 = new String(bArr2, b.O); try { c0002b.close(); } catch (IOException unused3) { } return str2; case 2: case 7: if (this.f42b >= b.E.length) { int i11 = 0; while (true) { bArr = b.E; if (i11 < bArr.length) { if (this.f43c[i11] != bArr[i11]) { z10 = false; } else { i11++; } } } if (z10) { i10 = bArr.length; } } StringBuilder sb2 = new StringBuilder(); while (i10 < this.f42b && (b11 = this.f43c[i10]) != 0) { if (b11 >= 32) { sb2.append((char) b11); } else { sb2.append('?'); } i10++; } String sb3 = sb2.toString(); try { c0002b.close(); } catch (IOException unused4) { } return sb3; case 3: ?? r11 = new int[this.f42b]; while (i10 < this.f42b) { r11[i10] = c0002b.readUnsignedShort(); i10++; } try { c0002b.close(); } catch (IOException unused5) { } return r11; case 4: ?? r112 = new long[this.f42b]; while (i10 < this.f42b) { r112[i10] = c0002b.readInt() & 4294967295L; i10++; } try { c0002b.close(); } catch (IOException unused6) { } return r112; case 5: ?? r113 = new f[this.f42b]; while (i10 < this.f42b) { r113[i10] = new f(c0002b.readInt() & 4294967295L, c0002b.readInt() & 4294967295L); i10++; } try { c0002b.close(); } catch (IOException unused7) { } return r113; case 8: ?? r114 = new int[this.f42b]; while (i10 < this.f42b) { r114[i10] = c0002b.readShort(); i10++; } try { c0002b.close(); } catch (IOException unused8) { } return r114; case 9: ?? r115 = new int[this.f42b]; while (i10 < this.f42b) { r115[i10] = c0002b.readInt(); i10++; } try { c0002b.close(); } catch (IOException unused9) { } return r115; case 10: ?? r116 = new f[this.f42b]; while (i10 < this.f42b) { r116[i10] = new f(c0002b.readInt(), c0002b.readInt()); i10++; } try { c0002b.close(); } catch (IOException unused10) { } return r116; case 11: ?? r117 = new double[this.f42b]; while (i10 < this.f42b) { r117[i10] = c0002b.readFloat(); i10++; } try { c0002b.close(); } catch (IOException unused11) { } return r117; case 12: ?? r118 = new double[this.f42b]; while (i10 < this.f42b) { r118[i10] = c0002b.readDouble(); i10++; } try { c0002b.close(); } catch (IOException unused12) { } return r118; default: try { c0002b.close(); } catch (IOException unused13) { } return null; } } catch (IOException unused14) { if (c0002b != null) { try { c0002b.close(); } catch (IOException unused15) { } } return null; } catch (Throwable th2) { th = th2; c0002b2 = c0002b; if (c0002b2 != null) { try { c0002b2.close(); } catch (IOException unused16) { } } throw th; } } public final String toString() { StringBuilder h10 = c.b.h("("); h10.append(b.C[this.f41a]); h10.append(", data length:"); return e5.b.d(h10, this.f43c.length, ")"); } } public static class f { public final long f48a; public final long f49b; public f(long j, long j10) { if (j10 == 0) { this.f48a = 0L; this.f49b = 1L; } else { this.f48a = j; this.f49b = j10; } } public final String toString() { return this.f48a + "/" + this.f49b; } } static { e[] eVarArr = {new e("NewSubfileType", 254, 4), new e("SubfileType", 255, 4), new e(256, "ImageWidth"), new e(257, "ImageLength"), new e("BitsPerSample", 258, 3), new e("Compression", 259, 3), new e("PhotometricInterpretation", 262, 3), new e("ImageDescription", 270, 2), new e("Make", 271, 2), new e("Model", 272, 2), new e(273, "StripOffsets"), new e("Orientation", 274, 3), new e("SamplesPerPixel", 277, 3), new e(278, "RowsPerStrip"), new e(279, "StripByteCounts"), new e("XResolution", 282, 5), new e("YResolution", 283, 5), new e("PlanarConfiguration", 284, 3), new e("ResolutionUnit", 296, 3), new e("TransferFunction", 301, 3), new e("Software", 305, 2), new e("DateTime", 306, 2), new e("Artist", 315, 2), new e("WhitePoint", 318, 5), new e("PrimaryChromaticities", 319, 5), new e("SubIFDPointer", 330, 4), new e("JPEGInterchangeFormat", 513, 4), new e("JPEGInterchangeFormatLength", 514, 4), new e("YCbCrCoefficients", 529, 5), new e("YCbCrSubSampling", 530, 3), new e("YCbCrPositioning", 531, 3), new e("ReferenceBlackWhite", 532, 5), new e("Copyright", 33432, 2), new e("ExifIFDPointer", 34665, 4), new e("GPSInfoIFDPointer", 34853, 4), new e("SensorTopBorder", 4, 4), new e("SensorLeftBorder", 5, 4), new e("SensorBottomBorder", 6, 4), new e("SensorRightBorder", 7, 4), new e("ISO", 23, 3), new e("JpgFromRaw", 46, 7), new e("Xmp", 700, 1)}; e[] eVarArr2 = {new e("ExposureTime", 33434, 5), new e("FNumber", 33437, 5), new e("ExposureProgram", 34850, 3), new e("SpectralSensitivity", 34852, 2), new e("PhotographicSensitivity", 34855, 3), new e("OECF", 34856, 7), new e("ExifVersion", 36864, 2), new e("DateTimeOriginal", 36867, 2), new e("DateTimeDigitized", 36868, 2), new e("ComponentsConfiguration", 37121, 7), new e("CompressedBitsPerPixel", 37122, 5), new e("ShutterSpeedValue", 37377, 10), new e("ApertureValue", 37378, 5), new e("BrightnessValue", 37379, 10), new e("ExposureBiasValue", 37380, 10), new e("MaxApertureValue", 37381, 5), new e("SubjectDistance", 37382, 5), new e("MeteringMode", 37383, 3), new e("LightSource", 37384, 3), new e("Flash", 37385, 3), new e("FocalLength", 37386, 5), new e("SubjectArea", 37396, 3), new e("MakerNote", 37500, 7), new e("UserComment", 37510, 7), new e("SubSecTime", 37520, 2), new e("SubSecTimeOriginal", 37521, 2), new e("SubSecTimeDigitized", 37522, 2), new e("FlashpixVersion", 40960, 7), new e("ColorSpace", 40961, 3), new e(40962, "PixelXDimension"), new e(40963, "PixelYDimension"), new e("RelatedSoundFile", 40964, 2), new e("InteroperabilityIFDPointer", 40965, 4), new e("FlashEnergy", 41483, 5), new e("SpatialFrequencyResponse", 41484, 7), new e("FocalPlaneXResolution", 41486, 5), new e("FocalPlaneYResolution", 41487, 5), new e("FocalPlaneResolutionUnit", 41488, 3), new e("SubjectLocation", 41492, 3), new e("ExposureIndex", 41493, 5), new e("SensingMethod", 41495, 3), new e("FileSource", 41728, 7), new e("SceneType", 41729, 7), new e("CFAPattern", 41730, 7), new e("CustomRendered", 41985, 3), new e("ExposureMode", 41986, 3), new e("WhiteBalance", 41987, 3), new e("DigitalZoomRatio", 41988, 5), new e("FocalLengthIn35mmFilm", 41989, 3), new e("SceneCaptureType", 41990, 3), new e("GainControl", 41991, 3), new e("Contrast", 41992, 3), new e("Saturation", 41993, 3), new e("Sharpness", 41994, 3), new e("DeviceSettingDescription", 41995, 7), new e("SubjectDistanceRange", 41996, 3), new e("ImageUniqueID", 42016, 2), new e("DNGVersion", 50706, 1), new e(50720, "DefaultCropSize")}; e[] eVarArr3 = {new e("GPSVersionID", 0, 1), new e("GPSLatitudeRef", 1, 2), new e("GPSLatitude", 2, 5), new e("GPSLongitudeRef", 3, 2), new e("GPSLongitude", 4, 5), new e("GPSAltitudeRef", 5, 1), new e("GPSAltitude", 6, 5), new e("GPSTimeStamp", 7, 5), new e("GPSSatellites", 8, 2), new e("GPSStatus", 9, 2), new e("GPSMeasureMode", 10, 2), new e("GPSDOP", 11, 5), new e("GPSSpeedRef", 12, 2), new e("GPSSpeed", 13, 5), new e("GPSTrackRef", 14, 2), new e("GPSTrack", 15, 5), new e("GPSImgDirectionRef", 16, 2), new e("GPSImgDirection", 17, 5), new e("GPSMapDatum", 18, 2), new e("GPSDestLatitudeRef", 19, 2), new e("GPSDestLatitude", 20, 5), new e("GPSDestLongitudeRef", 21, 2), new e("GPSDestLongitude", 22, 5), new e("GPSDestBearingRef", 23, 2), new e("GPSDestBearing", 24, 5), new e("GPSDestDistanceRef", 25, 2), new e("GPSDestDistance", 26, 5), new e("GPSProcessingMethod", 27, 7), new e("GPSAreaInformation", 28, 7), new e("GPSDateStamp", 29, 2), new e("GPSDifferential", 30, 3)}; e[] eVarArr4 = {new e("InteroperabilityIndex", 1, 2)}; e[] eVarArr5 = {new e("NewSubfileType", 254, 4), new e("SubfileType", 255, 4), new e(256, "ThumbnailImageWidth"), new e(257, "ThumbnailImageLength"), new e("BitsPerSample", 258, 3), new e("Compression", 259, 3), new e("PhotometricInterpretation", 262, 3), new e("ImageDescription", 270, 2), new e("Make", 271, 2), new e("Model", 272, 2), new e(273, "StripOffsets"), new e("ThumbnailOrientation", 274, 3), new e("SamplesPerPixel", 277, 3), new e(278, "RowsPerStrip"), new e(279, "StripByteCounts"), new e("XResolution", 282, 5), new e("YResolution", 283, 5), new e("PlanarConfiguration", 284, 3), new e("ResolutionUnit", 296, 3), new e("TransferFunction", 301, 3), new e("Software", 305, 2), new e("DateTime", 306, 2), new e("Artist", 315, 2), new e("WhitePoint", 318, 5), new e("PrimaryChromaticities", 319, 5), new e("SubIFDPointer", 330, 4), new e("JPEGInterchangeFormat", 513, 4), new e("JPEGInterchangeFormatLength", 514, 4), new e("YCbCrCoefficients", 529, 5), new e("YCbCrSubSampling", 530, 3), new e("YCbCrPositioning", 531, 3), new e("ReferenceBlackWhite", 532, 5), new e("Copyright", 33432, 2), new e("ExifIFDPointer", 34665, 4), new e("GPSInfoIFDPointer", 34853, 4), new e("DNGVersion", 50706, 1), new e(50720, "DefaultCropSize")}; F = new e("StripOffsets", 273, 3); G = new e[][]{eVarArr, eVarArr2, eVarArr3, eVarArr4, eVarArr5, eVarArr, new e[]{new e("ThumbnailImage", 256, 7), new e("CameraSettingsIFDPointer", 8224, 4), new e("ImageProcessingIFDPointer", 8256, 4)}, new e[]{new e("PreviewImageStart", 257, 4), new e("PreviewImageLength", 258, 4)}, new e[]{new e("AspectFrame", 4371, 3)}, new e[]{new e("ColorSpace", 55, 3)}}; H = new e[]{new e("SubIFDPointer", 330, 4), new e("ExifIFDPointer", 34665, 4), new e("GPSInfoIFDPointer", 34853, 4), new e("InteroperabilityIFDPointer", 40965, 4), new e("CameraSettingsIFDPointer", 8224, 1), new e("ImageProcessingIFDPointer", 8256, 1)}; I = new e("JPEGInterchangeFormat", 513, 4); J = new e("JPEGInterchangeFormatLength", 514, 4); K = new HashMap[10]; L = new HashMap[10]; M = new HashSet<>(Arrays.asList("FNumber", "DigitalZoomRatio", "ExposureTime", "SubjectDistance", "GPSTimeStamp")); N = new HashMap<>(); Charset forName = Charset.forName("US-ASCII"); O = forName; P = "Exif\u0000\u0000".getBytes(forName); Q = "http://ns.adobe.com/xap/1.0/\u0000".getBytes(forName); new SimpleDateFormat("yyyy:MM:dd HH:mm:ss").setTimeZone(TimeZone.getTimeZone("UTC")); int i10 = 0; while (true) { e[][] eVarArr6 = G; if (i10 < eVarArr6.length) { K[i10] = new HashMap<>(); L[i10] = new HashMap<>(); for (e eVar : eVarArr6[i10]) { K[i10].put(Integer.valueOf(eVar.f44a), eVar); L[i10].put(eVar.f45b, eVar); } i10++; } else { HashMap<Integer, Integer> hashMap = N; e[] eVarArr7 = H; hashMap.put(Integer.valueOf(eVarArr7[0].f44a), 5); hashMap.put(Integer.valueOf(eVarArr7[1].f44a), 1); hashMap.put(Integer.valueOf(eVarArr7[2].f44a), 2); hashMap.put(Integer.valueOf(eVarArr7[3].f44a), 3); hashMap.put(Integer.valueOf(eVarArr7[4].f44a), 7); hashMap.put(Integer.valueOf(eVarArr7[5].f44a), 8); Pattern.compile(".*[1-9].*"); R = Pattern.compile("^([0-9][0-9]):([0-9][0-9]):([0-9][0-9])$"); return; } } } public b(String str) throws IOException { boolean z10; e[][] eVarArr = G; this.f19d = new HashMap[eVarArr.length]; this.f20e = new HashSet(eVarArr.length); this.f21f = ByteOrder.BIG_ENDIAN; if (str != null) { FileInputStream fileInputStream = null; this.f16a = str; try { FileInputStream fileInputStream2 = new FileInputStream(str); try { try { Os.lseek(fileInputStream2.getFD(), 0L, OsConstants.SEEK_CUR); z10 = true; } catch (Exception unused) { z10 = false; } if (z10) { this.f17b = fileInputStream2.getFD(); } else { this.f17b = null; } q(fileInputStream2); b(fileInputStream2); } catch (Throwable th) { th = th; fileInputStream = fileInputStream2; b(fileInputStream); throw th; } } catch (Throwable th2) { th = th2; } } else { throw new NullPointerException("filename cannot be null"); } } public static void b(Closeable closeable) { if (closeable != null) { try { closeable.close(); } catch (RuntimeException e10) { throw e10; } catch (Exception unused) { } } } public static long[] c(Serializable serializable) { if (serializable instanceof int[]) { int[] iArr = (int[]) serializable; long[] jArr = new long[iArr.length]; for (int i10 = 0; i10 < iArr.length; i10++) { jArr[i10] = iArr[i10]; } return jArr; } if (serializable instanceof long[]) { return (long[]) serializable; } return null; } public static Pair<Integer, Integer> n(String str) { int intValue; int i10; if (str.contains(",")) { String[] split = str.split(",", -1); Pair<Integer, Integer> n10 = n(split[0]); if (((Integer) n10.first).intValue() == 2) { return n10; } for (int i11 = 1; i11 < split.length; i11++) { Pair<Integer, Integer> n11 = n(split[i11]); if (!((Integer) n11.first).equals(n10.first) && !((Integer) n11.second).equals(n10.first)) { intValue = -1; } else { intValue = ((Integer) n10.first).intValue(); } if (((Integer) n10.second).intValue() != -1 && (((Integer) n11.first).equals(n10.second) || ((Integer) n11.second).equals(n10.second))) { i10 = ((Integer) n10.second).intValue(); } else { i10 = -1; } if (intValue == -1 && i10 == -1) { return new Pair<>(2, -1); } if (intValue == -1) { n10 = new Pair<>(Integer.valueOf(i10), -1); } else if (i10 == -1) { n10 = new Pair<>(Integer.valueOf(intValue), -1); } } return n10; } if (str.contains("/")) { String[] split2 = str.split("/", -1); if (split2.length == 2) { try { long parseDouble = (long) Double.parseDouble(split2[0]); long parseDouble2 = (long) Double.parseDouble(split2[1]); if (parseDouble >= 0 && parseDouble2 >= 0) { if (parseDouble <= 2147483647L && parseDouble2 <= 2147483647L) { return new Pair<>(10, 5); } return new Pair<>(5, -1); } return new Pair<>(10, -1); } catch (NumberFormatException unused) { } } return new Pair<>(2, -1); } try { try { Long valueOf = Long.valueOf(Long.parseLong(str)); if (valueOf.longValue() >= 0 && valueOf.longValue() <= 65535) { return new Pair<>(3, 4); } if (valueOf.longValue() < 0) { return new Pair<>(9, -1); } return new Pair<>(4, -1); } catch (NumberFormatException unused2) { return new Pair<>(2, -1); } } catch (NumberFormatException unused3) { Double.parseDouble(str); return new Pair<>(12, -1); } } public static ByteOrder t(C0002b c0002b) throws IOException { short readShort = c0002b.readShort(); if (readShort != 18761) { if (readShort == 19789) { return ByteOrder.BIG_ENDIAN; } StringBuilder h10 = c.b.h("Invalid byte order: "); h10.append(Integer.toHexString(readShort)); throw new IOException(h10.toString()); } return ByteOrder.LITTLE_ENDIAN; } public final void A(int i10, int i11) throws IOException { if (!this.f19d[i10].isEmpty() && !this.f19d[i11].isEmpty()) { d dVar = this.f19d[i10].get("ImageLength"); d dVar2 = this.f19d[i10].get("ImageWidth"); d dVar3 = this.f19d[i11].get("ImageLength"); d dVar4 = this.f19d[i11].get("ImageWidth"); if (dVar != null && dVar2 != null && dVar3 != null && dVar4 != null) { int h10 = dVar.h(this.f21f); int h11 = dVar2.h(this.f21f); int h12 = dVar3.h(this.f21f); int h13 = dVar4.h(this.f21f); if (h10 < h12 && h11 < h13) { HashMap<String, d>[] hashMapArr = this.f19d; HashMap<String, d> hashMap = hashMapArr[i10]; hashMapArr[i10] = hashMapArr[i11]; hashMapArr[i11] = hashMap; } } } } public final void B(C0002b c0002b, int i10) throws IOException { d dVar; d e10; d e11; d dVar2 = this.f19d[i10].get("DefaultCropSize"); d dVar3 = this.f19d[i10].get("SensorTopBorder"); d dVar4 = this.f19d[i10].get("SensorLeftBorder"); d dVar5 = this.f19d[i10].get("SensorBottomBorder"); d dVar6 = this.f19d[i10].get("SensorRightBorder"); if (dVar2 != null) { if (dVar2.f41a == 5) { f[] fVarArr = (f[]) dVar2.j(this.f21f); if (fVarArr != null && fVarArr.length == 2) { e10 = d.d(new f[]{fVarArr[0]}, this.f21f); e11 = d.d(new f[]{fVarArr[1]}, this.f21f); } else { Arrays.toString(fVarArr); return; } } else { int[] iArr = (int[]) dVar2.j(this.f21f); if (iArr != null && iArr.length == 2) { e10 = d.e(iArr[0], this.f21f); e11 = d.e(iArr[1], this.f21f); } else { Arrays.toString(iArr); return; } } this.f19d[i10].put("ImageWidth", e10); this.f19d[i10].put("ImageLength", e11); return; } if (dVar3 != null && dVar4 != null && dVar5 != null && dVar6 != null) { int h10 = dVar3.h(this.f21f); int h11 = dVar5.h(this.f21f); int h12 = dVar6.h(this.f21f); int h13 = dVar4.h(this.f21f); if (h11 > h10 && h12 > h13) { d e12 = d.e(h11 - h10, this.f21f); d e13 = d.e(h12 - h13, this.f21f); this.f19d[i10].put("ImageLength", e12); this.f19d[i10].put("ImageWidth", e13); return; } return; } d dVar7 = this.f19d[i10].get("ImageLength"); d dVar8 = this.f19d[i10].get("ImageWidth"); if ((dVar7 == null || dVar8 == null) && (dVar = this.f19d[i10].get("JPEGInterchangeFormat")) != null) { g(c0002b, dVar.h(this.f21f), i10); } } public final void a() { String d10 = d("DateTimeOriginal"); if (d10 != null && d("DateTime") == null) { this.f19d[0].put("DateTime", d.a(d10)); } if (d("ImageWidth") == null) { this.f19d[0].put("ImageWidth", d.b(0L, this.f21f)); } if (d("ImageLength") == null) { this.f19d[0].put("ImageLength", d.b(0L, this.f21f)); } if (d("Orientation") == null) { this.f19d[0].put("Orientation", d.b(0L, this.f21f)); } if (d("LightSource") == null) { this.f19d[1].put("LightSource", d.b(0L, this.f21f)); } } public final String d(String str) { if (str != null) { d e10 = e(str); if (e10 != null) { if (!M.contains(str)) { return e10.i(this.f21f); } if (str.equals("GPSTimeStamp")) { int i10 = e10.f41a; if (i10 != 5 && i10 != 10) { return null; } f[] fVarArr = (f[]) e10.j(this.f21f); if (fVarArr != null && fVarArr.length == 3) { f fVar = fVarArr[0]; f fVar2 = fVarArr[1]; f fVar3 = fVarArr[2]; return String.format("%02d:%02d:%02d", Integer.valueOf((int) (((float) fVar.f48a) / ((float) fVar.f49b))), Integer.valueOf((int) (((float) fVar2.f48a) / ((float) fVar2.f49b))), Integer.valueOf((int) (((float) fVar3.f48a) / ((float) fVar3.f49b)))); } Arrays.toString(fVarArr); return null; } try { return Double.toString(e10.g(this.f21f)); } catch (NumberFormatException unused) { } } return null; } throw new NullPointerException("tag shouldn't be null"); } public final d e(String str) { if (str != null) { if ("ISOSpeedRatings".equals(str)) { str = "PhotographicSensitivity"; } for (int i10 = 0; i10 < G.length; i10++) { d dVar = this.f19d[i10].get(str); if (dVar != null) { return dVar; } } return null; } throw new NullPointerException("tag shouldn't be null"); } public final void f(C0002b c0002b) throws IOException { String str; String str2; MediaMetadataRetriever mediaMetadataRetriever = new MediaMetadataRetriever(); try { if (Build.VERSION.SDK_INT >= 23) { mediaMetadataRetriever.setDataSource(new a(c0002b)); } else { FileDescriptor fileDescriptor = this.f17b; if (fileDescriptor != null) { mediaMetadataRetriever.setDataSource(fileDescriptor); } else { String str3 = this.f16a; if (str3 != null) { mediaMetadataRetriever.setDataSource(str3); } else { return; } } } String extractMetadata = mediaMetadataRetriever.extractMetadata(33); String extractMetadata2 = mediaMetadataRetriever.extractMetadata(34); String extractMetadata3 = mediaMetadataRetriever.extractMetadata(26); String extractMetadata4 = mediaMetadataRetriever.extractMetadata(17); String str4 = null; if ("yes".equals(extractMetadata3)) { str4 = mediaMetadataRetriever.extractMetadata(29); str = mediaMetadataRetriever.extractMetadata(30); str2 = mediaMetadataRetriever.extractMetadata(31); } else if ("yes".equals(extractMetadata4)) { str4 = mediaMetadataRetriever.extractMetadata(18); str = mediaMetadataRetriever.extractMetadata(19); str2 = mediaMetadataRetriever.extractMetadata(24); } else { str = null; str2 = null; } if (str4 != null) { this.f19d[0].put("ImageWidth", d.e(Integer.parseInt(str4), this.f21f)); } if (str != null) { this.f19d[0].put("ImageLength", d.e(Integer.parseInt(str), this.f21f)); } if (str2 != null) { int i10 = 1; int parseInt = Integer.parseInt(str2); if (parseInt != 90) { if (parseInt != 180) { if (parseInt == 270) { i10 = 8; } } else { i10 = 3; } } else { i10 = 6; } this.f19d[0].put("Orientation", d.e(i10, this.f21f)); } if (extractMetadata != null && extractMetadata2 != null) { int parseInt2 = Integer.parseInt(extractMetadata); int parseInt3 = Integer.parseInt(extractMetadata2); if (parseInt3 > 6) { c0002b.a(parseInt2); byte[] bArr = new byte[6]; if (c0002b.read(bArr) == 6) { int i11 = parseInt3 - 6; if (Arrays.equals(bArr, P)) { byte[] bArr2 = new byte[i11]; if (c0002b.read(bArr2) == i11) { C0002b c0002b2 = new C0002b(bArr2); r(c0002b2, i11); u(c0002b2, 0); } else { throw new IOException("Can't read exif"); } } else { throw new IOException("Invalid identifier"); } } else { throw new IOException("Can't read identifier"); } } else { throw new IOException("Invalid exif length"); } } } finally { mediaMetadataRetriever.release(); } } public final void g(C0002b c0002b, int i10, int i11) throws IOException { boolean z10; boolean z11; if (f8r) { Objects.toString(c0002b); } c0002b.f37t = ByteOrder.BIG_ENDIAN; c0002b.a(i10); byte readByte = c0002b.readByte(); if (readByte == -1) { int i12 = i10 + 1; if (c0002b.readByte() == -40) { int i13 = i12 + 1; while (true) { byte readByte2 = c0002b.readByte(); if (readByte2 == -1) { int i14 = i13 + 1; byte readByte3 = c0002b.readByte(); boolean z12 = f8r; if (z12) { Integer.toHexString(readByte3 & 255); } int i15 = i14 + 1; if (readByte3 != -39 && readByte3 != -38) { int readUnsignedShort = c0002b.readUnsignedShort() - 2; int i16 = i15 + 2; if (z12) { Integer.toHexString(readByte3 & 255); } if (readUnsignedShort >= 0) { if (readByte3 != -31) { if (readByte3 != -2) { switch (readByte3) { default: switch (readByte3) { default: switch (readByte3) { default: switch (readByte3) { } case -55: case -54: case -53: if (c0002b.skipBytes(1) == 1) { this.f19d[i11].put("ImageLength", d.b(c0002b.readUnsignedShort(), this.f21f)); this.f19d[i11].put("ImageWidth", d.b(c0002b.readUnsignedShort(), this.f21f)); readUnsignedShort -= 5; break; } else { throw new IOException("Invalid SOFx"); } } case -59: case -58: case -57: break; } case -64: case -63: case -62: case -61: break; } if (readUnsignedShort < 0) { if (c0002b.skipBytes(readUnsignedShort) == readUnsignedShort) { i13 = i16 + readUnsignedShort; } else { throw new IOException("Invalid JPEG segment"); } } else { throw new IOException("Invalid length"); } } } else { byte[] bArr = new byte[readUnsignedShort]; c0002b.readFully(bArr); int i17 = i16 + readUnsignedShort; byte[] bArr2 = P; if (bArr2 != null && readUnsignedShort >= bArr2.length) { for (int i18 = 0; i18 < bArr2.length; i18++) { if (bArr[i18] == bArr2[i18]) { } } z10 = true; if (!z10) { long length = i16 + bArr2.length; byte[] copyOfRange = Arrays.copyOfRange(bArr, bArr2.length, readUnsignedShort); C0002b c0002b2 = new C0002b(copyOfRange); r(c0002b2, copyOfRange.length); u(c0002b2, i11); this.f26l = (int) length; } else { byte[] bArr3 = Q; if (bArr3 != null && readUnsignedShort >= bArr3.length) { for (int i19 = 0; i19 < bArr3.length; i19++) { if (bArr[i19] == bArr3[i19]) { } } z11 = true; if (z11) { int length2 = bArr3.length; byte[] copyOfRange2 = Arrays.copyOfRange(bArr, bArr3.length, readUnsignedShort); if (d("Xmp") == null) { this.f19d[0].put("Xmp", new d(copyOfRange2, 1, copyOfRange2.length, 0)); } } } z11 = false; if (z11) { } } readUnsignedShort = 0; i16 = i17; } z10 = false; if (!z10) { } readUnsignedShort = 0; i16 = i17; } byte[] bArr4 = new byte[readUnsignedShort]; if (c0002b.read(bArr4) == readUnsignedShort) { if (d("UserComment") == null) { this.f19d[1].put("UserComment", d.a(new String(bArr4, O))); } readUnsignedShort = 0; if (readUnsignedShort < 0) { } } else { throw new IOException("Invalid exif"); } } else { throw new IOException("Invalid length"); } } } else { StringBuilder h10 = c.b.h("Invalid marker:"); h10.append(Integer.toHexString(readByte2 & 255)); throw new IOException(h10.toString()); } } } else { StringBuilder h11 = c.b.h("Invalid marker: "); h11.append(Integer.toHexString(readByte & 255)); throw new IOException(h11.toString()); } } else { StringBuilder h12 = c.b.h("Invalid marker: "); h12.append(Integer.toHexString(readByte & 255)); throw new IOException(h12.toString()); } } public final int h(BufferedInputStream bufferedInputStream) throws IOException { boolean z10; boolean z11; boolean z12; boolean z13; boolean z14; bufferedInputStream.mark(5000); byte[] bArr = new byte[5000]; bufferedInputStream.read(bArr); bufferedInputStream.reset(); int i10 = 0; while (true) { byte[] bArr2 = f12w; z10 = true; if (i10 < bArr2.length) { if (bArr[i10] != bArr2[i10]) { z11 = false; break; } i10++; } else { z11 = true; break; } } if (z11) { return 4; } byte[] bytes = "FUJIFILMCCD-RAW".getBytes(Charset.defaultCharset()); int i11 = 0; while (true) { if (i11 < bytes.length) { if (bArr[i11] != bytes[i11]) { z12 = false; break; } i11++; } else { z12 = true; break; } } if (z12) { return 9; } C0002b c0002b = null; try { C0002b c0002b2 = new C0002b(bArr); try { c0002b2.f37t = ByteOrder.BIG_ENDIAN; long readInt = c0002b2.readInt(); byte[] bArr3 = new byte[4]; c0002b2.read(bArr3); if (Arrays.equals(bArr3, f13x)) { long j = 16; if (readInt == 1) { readInt = c0002b2.readLong(); if (readInt < 16) { } } else { j = 8; } long j10 = 5000; if (readInt > j10) { readInt = j10; } long j11 = readInt - j; if (j11 >= 8) { byte[] bArr4 = new byte[4]; boolean z15 = false; boolean z16 = false; for (long j12 = 0; j12 < j11 / 4 && c0002b2.read(bArr4) == 4; j12++) { if (j12 != 1) { if (Arrays.equals(bArr4, f14y)) { z15 = true; } else if (Arrays.equals(bArr4, f15z)) { z16 = true; } if (z15 && z16) { c0002b2.close(); z13 = true; break; } } } } } c0002b2.close(); } catch (Exception unused) { c0002b = c0002b2; if (c0002b != null) { c0002b.close(); } z13 = false; if (!z13) { } } catch (Throwable th) { th = th; c0002b = c0002b2; if (c0002b != null) { c0002b.close(); } throw th; } } catch (Exception unused2) { } catch (Throwable th2) { th = th2; } z13 = false; if (!z13) { return 12; } C0002b c0002b3 = new C0002b(bArr); ByteOrder t10 = t(c0002b3); this.f21f = t10; c0002b3.f37t = t10; short readShort = c0002b3.readShort(); c0002b3.close(); if (readShort != 20306 && readShort != 21330) { z14 = false; } else { z14 = true; } if (z14) { return 7; } C0002b c0002b4 = new C0002b(bArr); ByteOrder t11 = t(c0002b4); this.f21f = t11; c0002b4.f37t = t11; short readShort2 = c0002b4.readShort(); c0002b4.close(); if (readShort2 != 85) { z10 = false; } if (z10) { return 10; } return 0; } public final void i(C0002b c0002b) throws IOException { int i10; int i11; k(c0002b); d dVar = this.f19d[1].get("MakerNote"); if (dVar != null) { C0002b c0002b2 = new C0002b(dVar.f43c); c0002b2.f37t = this.f21f; byte[] bArr = A; byte[] bArr2 = new byte[bArr.length]; c0002b2.readFully(bArr2); c0002b2.a(0L); byte[] bArr3 = B; byte[] bArr4 = new byte[bArr3.length]; c0002b2.readFully(bArr4); if (Arrays.equals(bArr2, bArr)) { c0002b2.a(8L); } else if (Arrays.equals(bArr4, bArr3)) { c0002b2.a(12L); } u(c0002b2, 6); d dVar2 = this.f19d[7].get("PreviewImageStart"); d dVar3 = this.f19d[7].get("PreviewImageLength"); if (dVar2 != null && dVar3 != null) { this.f19d[5].put("JPEGInterchangeFormat", dVar2); this.f19d[5].put("JPEGInterchangeFormatLength", dVar3); } d dVar4 = this.f19d[8].get("AspectFrame"); if (dVar4 != null) { int[] iArr = (int[]) dVar4.j(this.f21f); if (iArr != null && iArr.length == 4) { int i12 = iArr[2]; int i13 = iArr[0]; if (i12 > i13 && (i10 = iArr[3]) > (i11 = iArr[1])) { int i14 = (i12 - i13) + 1; int i15 = (i10 - i11) + 1; if (i14 < i15) { int i16 = i14 + i15; i15 = i16 - i15; i14 = i16 - i15; } d e10 = d.e(i14, this.f21f); d e11 = d.e(i15, this.f21f); this.f19d[0].put("ImageWidth", e10); this.f19d[0].put("ImageLength", e11); return; } return; } Arrays.toString(iArr); } } } public final void j(C0002b c0002b) throws IOException { c0002b.skipBytes(84); byte[] bArr = new byte[4]; byte[] bArr2 = new byte[4]; c0002b.read(bArr); c0002b.skipBytes(4); c0002b.read(bArr2); int i10 = ByteBuffer.wrap(bArr).getInt(); int i11 = ByteBuffer.wrap(bArr2).getInt(); g(c0002b, i10, 5); c0002b.a(i11); c0002b.f37t = ByteOrder.BIG_ENDIAN; int readInt = c0002b.readInt(); for (int i12 = 0; i12 < readInt; i12++) { int readUnsignedShort = c0002b.readUnsignedShort(); int readUnsignedShort2 = c0002b.readUnsignedShort(); if (readUnsignedShort == F.f44a) { short readShort = c0002b.readShort(); short readShort2 = c0002b.readShort(); d e10 = d.e(readShort, this.f21f); d e11 = d.e(readShort2, this.f21f); this.f19d[0].put("ImageLength", e10); this.f19d[0].put("ImageWidth", e11); return; } c0002b.skipBytes(readUnsignedShort2); } } public final void k(C0002b c0002b) throws IOException { d dVar; r(c0002b, c0002b.available()); u(c0002b, 0); B(c0002b, 0); B(c0002b, 5); B(c0002b, 4); A(0, 5); A(0, 4); A(5, 4); d dVar2 = this.f19d[1].get("PixelXDimension"); d dVar3 = this.f19d[1].get("PixelYDimension"); if (dVar2 != null && dVar3 != null) { this.f19d[0].put("ImageWidth", dVar2); this.f19d[0].put("ImageLength", dVar3); } if (this.f19d[4].isEmpty() && p(this.f19d[5])) { HashMap<String, d>[] hashMapArr = this.f19d; hashMapArr[4] = hashMapArr[5]; hashMapArr[5] = new HashMap<>(); } p(this.f19d[4]); if (this.f18c == 8 && (dVar = this.f19d[1].get("MakerNote")) != null) { C0002b c0002b2 = new C0002b(dVar.f43c); c0002b2.f37t = this.f21f; c0002b2.a(6L); u(c0002b2, 9); d dVar4 = this.f19d[9].get("ColorSpace"); if (dVar4 != null) { this.f19d[1].put("ColorSpace", dVar4); } } } public final void l(C0002b c0002b) throws IOException { k(c0002b); if (this.f19d[0].get("JpgFromRaw") != null) { g(c0002b, this.f30p, 5); } d dVar = this.f19d[0].get("ISO"); d dVar2 = this.f19d[1].get("PhotographicSensitivity"); if (dVar != null && dVar2 == null) { this.f19d[1].put("PhotographicSensitivity", dVar); } } public final byte[] m() { FileDescriptor fileDescriptor; FileInputStream fileInputStream; Throwable th; FileInputStream fileInputStream2 = null; if (!this.f22g) { return null; } byte[] bArr = this.j; if (bArr != null) { return bArr; } try { if (this.f16a != null) { fileInputStream = new FileInputStream(this.f16a); fileDescriptor = null; } else { FileDescriptor fileDescriptor2 = this.f17b; if (fileDescriptor2 != null) { FileDescriptor dup = Os.dup(fileDescriptor2); try { Os.lseek(dup, 0L, OsConstants.SEEK_SET); fileDescriptor = dup; fileInputStream = new FileInputStream(dup); } catch (Exception unused) { fileDescriptor = dup; fileInputStream = null; b(fileInputStream); if (fileDescriptor != null) { try { Os.close(fileDescriptor); } catch (Exception unused2) { } } return null; } catch (Throwable th2) { th = th2; fileDescriptor = dup; th = th; b(fileInputStream2); if (fileDescriptor != null) { try { Os.close(fileDescriptor); } catch (Exception unused3) { } } throw th; } } else { fileInputStream = null; fileDescriptor = null; } } } catch (Exception unused4) { fileInputStream = null; fileDescriptor = null; } catch (Throwable th3) { th = th3; fileDescriptor = null; } try { if (fileInputStream != null) { if (fileInputStream.skip(this.f23h) == this.f23h) { byte[] bArr2 = new byte[this.f24i]; if (fileInputStream.read(bArr2) == this.f24i) { this.j = bArr2; b(fileInputStream); if (fileDescriptor != null) { try { Os.close(fileDescriptor); } catch (Exception unused5) { } } return bArr2; } throw new IOException("Corrupted image"); } throw new IOException("Corrupted image"); } throw new FileNotFoundException(); } catch (Exception unused6) { b(fileInputStream); if (fileDescriptor != null) { } return null; } catch (Throwable th4) { th = th4; fileInputStream2 = fileInputStream; th = th; b(fileInputStream2); if (fileDescriptor != null) { } throw th; } } public final void o(C0002b c0002b, HashMap hashMap) throws IOException { int i10; d dVar = (d) hashMap.get("JPEGInterchangeFormat"); d dVar2 = (d) hashMap.get("JPEGInterchangeFormatLength"); if (dVar != null && dVar2 != null) { int h10 = dVar.h(this.f21f); int min = Math.min(dVar2.h(this.f21f), c0002b.f38u - h10); int i11 = this.f18c; if (i11 != 4 && i11 != 9 && i11 != 10) { if (i11 == 7) { i10 = this.f27m; } if (h10 <= 0 && min > 0) { this.f22g = true; this.f23h = h10; this.f24i = min; if (this.f16a == null && this.f17b == null) { byte[] bArr = new byte[min]; c0002b.a(h10); c0002b.readFully(bArr); this.j = bArr; return; } return; } } i10 = this.f26l; h10 += i10; if (h10 <= 0) { } } } public final boolean p(HashMap hashMap) throws IOException { d dVar = (d) hashMap.get("ImageLength"); d dVar2 = (d) hashMap.get("ImageWidth"); if (dVar != null && dVar2 != null) { int h10 = dVar.h(this.f21f); int h11 = dVar2.h(this.f21f); if (h10 <= 512 && h11 <= 512) { return true; } return false; } return false; } public final void q(FileInputStream fileInputStream) throws IOException { for (int i10 = 0; i10 < G.length; i10++) { try { try { this.f19d[i10] = new HashMap<>(); } catch (IOException unused) { this.f31q = false; boolean z10 = f8r; a(); if (!z10) { return; } } } finally { a(); if (f8r) { s(); } } } BufferedInputStream bufferedInputStream = new BufferedInputStream(fileInputStream, 5000); this.f18c = h(bufferedInputStream); C0002b c0002b = new C0002b(bufferedInputStream); switch (this.f18c) { case 0: case 1: case 2: case 3: case 5: case 6: case 8: case 11: k(c0002b); break; case 4: g(c0002b, 0, 0); break; case 7: i(c0002b); break; case 9: j(c0002b); break; case 10: l(c0002b); break; case 12: f(c0002b); break; } z(c0002b); this.f31q = true; } public final void r(C0002b c0002b, int i10) throws IOException { ByteOrder t10 = t(c0002b); this.f21f = t10; c0002b.f37t = t10; int readUnsignedShort = c0002b.readUnsignedShort(); int i11 = this.f18c; if (i11 != 7 && i11 != 10 && readUnsignedShort != 42) { StringBuilder h10 = c.b.h("Invalid start code: "); h10.append(Integer.toHexString(readUnsignedShort)); throw new IOException(h10.toString()); } int readInt = c0002b.readInt(); if (readInt >= 8 && readInt < i10) { int i12 = readInt - 8; if (i12 > 0 && c0002b.skipBytes(i12) != i12) { throw new IOException(e5.b.a("Couldn't jump to first Ifd: ", i12)); } return; } throw new IOException(e5.b.a("Invalid first Ifd offset: ", readInt)); } public final void s() { for (int i10 = 0; i10 < this.f19d.length; i10++) { this.f19d[i10].size(); for (Map.Entry<String, d> entry : this.f19d[i10].entrySet()) { d value = entry.getValue(); entry.getKey(); value.toString(); value.i(this.f21f); } } } public final void u(C0002b c0002b, int i10) throws IOException { boolean z10; short s10; long j; boolean z11; int i11; short s11; short s12; int i12; boolean z12; String str; int readUnsignedShort; String str2; int i13 = i10; this.f20e.add(Integer.valueOf(c0002b.v)); if (c0002b.v + 2 > c0002b.f38u) { return; } short readShort = c0002b.readShort(); if ((readShort * 12) + c0002b.v <= c0002b.f38u && readShort > 0) { char c10 = 0; short s13 = 0; while (s13 < readShort) { int readUnsignedShort2 = c0002b.readUnsignedShort(); int readUnsignedShort3 = c0002b.readUnsignedShort(); int readInt = c0002b.readInt(); long j10 = c0002b.v + 4; e eVar = K[i13].get(Integer.valueOf(readUnsignedShort2)); boolean z13 = f8r; if (z13) { Object[] objArr = new Object[5]; objArr[c10] = Integer.valueOf(i10); objArr[1] = Integer.valueOf(readUnsignedShort2); if (eVar != null) { str2 = eVar.f45b; } else { str2 = null; } objArr[2] = str2; objArr[3] = Integer.valueOf(readUnsignedShort3); objArr[4] = Integer.valueOf(readInt); String.format("ifdType: %d, tagNumber: %d, tagName: %s, dataFormat: %d, numberOfComponents: %d", objArr); } if (eVar != null && readUnsignedShort3 > 0) { int[] iArr = D; if (readUnsignedShort3 < iArr.length) { int i14 = eVar.f46c; if (i14 != 7 && readUnsignedShort3 != 7 && i14 != readUnsignedShort3 && (i11 = eVar.f47d) != readUnsignedShort3 && (((i14 != 4 && i11 != 4) || readUnsignedShort3 != 3) && (((i14 != 9 && i11 != 9) || readUnsignedShort3 != 8) && ((i14 != 12 && i11 != 12) || readUnsignedShort3 != 11)))) { z10 = false; } else { z10 = true; } if (!z10) { if (z13) { String str3 = C[readUnsignedShort3]; } } else { if (readUnsignedShort3 == 7) { readUnsignedShort3 = i14; } int i15 = iArr[readUnsignedShort3]; s10 = s13; j = readInt * i15; if (j >= 0 && j <= 2147483647L) { z11 = true; if (!z11) { c0002b.a(j10); s11 = readShort; s12 = s10; } else { if (j > 4) { int readInt2 = c0002b.readInt(); s11 = readShort; int i16 = this.f18c; s12 = s10; if (i16 == 7) { if ("MakerNote".equals(eVar.f45b)) { this.f27m = readInt2; } else if (i13 == 6 && "ThumbnailImage".equals(eVar.f45b)) { this.f28n = readInt2; this.f29o = readInt; d e10 = d.e(6, this.f21f); i12 = readInt; z12 = z13; d b10 = d.b(this.f28n, this.f21f); d b11 = d.b(this.f29o, this.f21f); this.f19d[4].put("Compression", e10); this.f19d[4].put("JPEGInterchangeFormat", b10); this.f19d[4].put("JPEGInterchangeFormatLength", b11); } i12 = readInt; z12 = z13; } else { i12 = readInt; z12 = z13; if (i16 == 10 && "JpgFromRaw".equals(eVar.f45b)) { this.f30p = readInt2; } } long j11 = readInt2; str = "Compression"; if (j11 + j <= c0002b.f38u) { c0002b.a(j11); } else { c0002b.a(j10); } } else { s11 = readShort; s12 = s10; i12 = readInt; z12 = z13; str = "Compression"; } Integer num = N.get(Integer.valueOf(readUnsignedShort2)); if (num != null) { long j12 = -1; if (readUnsignedShort3 != 3) { if (readUnsignedShort3 != 4) { if (readUnsignedShort3 != 8) { if (readUnsignedShort3 == 9 || readUnsignedShort3 == 13) { readUnsignedShort = c0002b.readInt(); } } else { readUnsignedShort = c0002b.readShort(); } } else { j12 = c0002b.readInt() & 4294967295L; } if (z12) { String.format("Offset: %d, tagName: %s", Long.valueOf(j12), eVar.f45b); } if (j12 > 0 && j12 < c0002b.f38u && !this.f20e.contains(Integer.valueOf((int) j12))) { c0002b.a(j12); u(c0002b, num.intValue()); } c0002b.a(j10); } else { readUnsignedShort = c0002b.readUnsignedShort(); } j12 = readUnsignedShort; if (z12) { } if (j12 > 0) { c0002b.a(j12); u(c0002b, num.intValue()); } c0002b.a(j10); } else { byte[] bArr = new byte[(int) j]; c0002b.readFully(bArr); d dVar = new d(bArr, readUnsignedShort3, i12, 0); this.f19d[i10].put(eVar.f45b, dVar); if ("DNGVersion".equals(eVar.f45b)) { this.f18c = 3; } if ((("Make".equals(eVar.f45b) || "Model".equals(eVar.f45b)) && dVar.i(this.f21f).contains("PENTAX")) || (str.equals(eVar.f45b) && dVar.h(this.f21f) == 65535)) { this.f18c = 8; } if (c0002b.v != j10) { c0002b.a(j10); } } s13 = (short) (s12 + 1); readShort = s11; c10 = 0; i13 = i10; } s13 = (short) (s12 + 1); readShort = s11; c10 = 0; i13 = i10; } z11 = false; if (!z11) { } s13 = (short) (s12 + 1); readShort = s11; c10 = 0; i13 = i10; } } } s10 = s13; j = 0; z11 = false; if (!z11) { } s13 = (short) (s12 + 1); readShort = s11; c10 = 0; i13 = i10; } if (c0002b.v + 4 <= c0002b.f38u) { int readInt3 = c0002b.readInt(); if (f8r) { String.format("nextIfdOffset: %d", Integer.valueOf(readInt3)); } long j13 = readInt3; if (j13 > 0 && readInt3 < c0002b.f38u && !this.f20e.contains(Integer.valueOf(readInt3))) { c0002b.a(j13); if (this.f19d[4].isEmpty()) { u(c0002b, 4); } else if (this.f19d[5].isEmpty()) { u(c0002b, 5); } } } } } public final void v(String str) { for (int i10 = 0; i10 < G.length; i10++) { this.f19d[i10].remove(str); } } public final void w() throws IOException { byte[] m10; File file; BufferedInputStream bufferedInputStream; File file2; ?? fileInputStream; ?? fileOutputStream; BufferedOutputStream bufferedOutputStream; BufferedInputStream bufferedInputStream2; FileOutputStream fileOutputStream2; if (this.f31q && this.f18c == 4) { if (this.f17b == null && this.f16a == null) { throw new IOException("ExifInterface does not support saving attributes for the current input."); } int i10 = this.f25k; BufferedInputStream bufferedInputStream3 = null; if (i10 != 6 && i10 != 7) { m10 = null; } else { m10 = m(); } this.j = m10; if (this.f16a != null) { file = new File(this.f16a); } else { file = null; } try { try { if (this.f16a != null) { file2 = new File(this.f16a + ".tmp"); if (!file.renameTo(file2)) { throw new IOException("Couldn't rename to " + file2.getAbsolutePath()); } } else if (this.f17b != null) { file2 = File.createTempFile("temp", "jpg"); Os.lseek(this.f17b, 0L, OsConstants.SEEK_SET); fileInputStream = new FileInputStream(this.f17b); try { fileOutputStream = new FileOutputStream(file2); try { byte[] bArr = new byte[8192]; while (true) { int read = fileInputStream.read(bArr); if (read == -1) { break; } else { fileOutputStream.write(bArr, 0, read); } } b(fileInputStream); b(fileOutputStream); FileInputStream fileInputStream2 = new FileInputStream(file2); if (this.f16a == null) { fileOutputStream2 = new FileOutputStream(this.f16a); } else { FileDescriptor fileDescriptor = this.f17b; if (fileDescriptor != null) { Os.lseek(fileDescriptor, 0L, OsConstants.SEEK_SET); fileOutputStream2 = new FileOutputStream(this.f17b); } else { fileOutputStream2 = null; } } bufferedInputStream2 = new BufferedInputStream(fileInputStream2); bufferedOutputStream = new BufferedOutputStream(fileOutputStream2); x(bufferedInputStream2, bufferedOutputStream); b(bufferedInputStream2); b(bufferedOutputStream); file2.delete(); this.j = null; return; } catch (Exception e10) { e = e10; bufferedInputStream3 = fileOutputStream; bufferedInputStream = bufferedInputStream3; bufferedInputStream3 = fileInputStream; try { throw new IOException("Failed to copy original file to temp file", e); } catch (Throwable th) { th = th; b(bufferedInputStream3); b(bufferedInputStream); throw th; } } catch (Throwable th2) { th = th2; bufferedInputStream3 = fileOutputStream; bufferedInputStream = bufferedInputStream3; bufferedInputStream3 = fileInputStream; b(bufferedInputStream3); b(bufferedInputStream); throw th; } } catch (Exception e11) { e = e11; } catch (Throwable th3) { th = th3; } } else { file2 = null; } x(bufferedInputStream2, bufferedOutputStream); b(bufferedInputStream2); b(bufferedOutputStream); file2.delete(); this.j = null; return; } catch (Exception e12) { Exception e13 = e12; try { if (this.f16a != null) { } throw new IOException("Failed to save new file", e13); } catch (Throwable th4) { th = th4; bufferedInputStream3 = bufferedInputStream2; b(bufferedInputStream3); b(bufferedOutputStream); file2.delete(); throw th; } } catch (Throwable th5) { th = th5; bufferedInputStream3 = bufferedOutputStream; bufferedOutputStream = bufferedInputStream3; bufferedInputStream3 = bufferedInputStream2; b(bufferedInputStream3); b(bufferedOutputStream); file2.delete(); throw th; } fileInputStream = 0; fileOutputStream = 0; b(fileInputStream); b(fileOutputStream); FileInputStream fileInputStream22 = new FileInputStream(file2); if (this.f16a == null) { } bufferedInputStream2 = new BufferedInputStream(fileInputStream22); bufferedOutputStream = new BufferedOutputStream(fileOutputStream2); } catch (Exception e14) { e = e14; bufferedInputStream = null; } catch (Throwable th6) { th = th6; bufferedInputStream = null; } } else { throw new IOException("ExifInterface only supports saving attributes on JPEG formats."); } } public final void x(BufferedInputStream bufferedInputStream, BufferedOutputStream bufferedOutputStream) throws IOException { short s10; if (f8r) { Objects.toString(bufferedInputStream); Objects.toString(bufferedOutputStream); } DataInputStream dataInputStream = new DataInputStream(bufferedInputStream); c cVar = new c(bufferedOutputStream, ByteOrder.BIG_ENDIAN); if (dataInputStream.readByte() == -1) { cVar.a(-1); if (dataInputStream.readByte() == -40) { cVar.a(-40); cVar.a(-1); cVar.a(-31); e[][] eVarArr = G; int[] iArr = new int[eVarArr.length]; int[] iArr2 = new int[eVarArr.length]; for (e eVar : H) { v(eVar.f45b); } v(I.f45b); v(J.f45b); for (int i10 = 0; i10 < G.length; i10++) { for (Object obj : this.f19d[i10].entrySet().toArray()) { Map.Entry entry = (Map.Entry) obj; if (entry.getValue() == null) { this.f19d[i10].remove(entry.getKey()); } } } if (!this.f19d[1].isEmpty()) { this.f19d[0].put(H[1].f45b, d.b(0L, this.f21f)); } if (!this.f19d[2].isEmpty()) { this.f19d[0].put(H[2].f45b, d.b(0L, this.f21f)); } if (!this.f19d[3].isEmpty()) { this.f19d[1].put(H[3].f45b, d.b(0L, this.f21f)); } if (this.f22g) { this.f19d[4].put(I.f45b, d.b(0L, this.f21f)); this.f19d[4].put(J.f45b, d.b(this.f24i, this.f21f)); } for (int i11 = 0; i11 < G.length; i11++) { Iterator<Map.Entry<String, d>> it = this.f19d[i11].entrySet().iterator(); int i12 = 0; while (it.hasNext()) { d value = it.next().getValue(); value.getClass(); int i13 = D[value.f41a] * value.f42b; if (i13 > 4) { i12 += i13; } } iArr2[i11] = iArr2[i11] + i12; } int i14 = 8; for (int i15 = 0; i15 < G.length; i15++) { if (!this.f19d[i15].isEmpty()) { iArr[i15] = i14; i14 += (this.f19d[i15].size() * 12) + 2 + 4 + iArr2[i15]; } } if (this.f22g) { this.f19d[4].put(I.f45b, d.b(i14, this.f21f)); this.f23h = i14 + 6; i14 += this.f24i; } int i16 = i14 + 8; if (f8r) { for (int i17 = 0; i17 < G.length; i17++) { String.format("index: %d, offsets: %d, tag count: %d, data sizes: %d", Integer.valueOf(i17), Integer.valueOf(iArr[i17]), Integer.valueOf(this.f19d[i17].size()), Integer.valueOf(iArr2[i17])); } } if (!this.f19d[1].isEmpty()) { this.f19d[0].put(H[1].f45b, d.b(iArr[1], this.f21f)); } if (!this.f19d[2].isEmpty()) { this.f19d[0].put(H[2].f45b, d.b(iArr[2], this.f21f)); } if (!this.f19d[3].isEmpty()) { this.f19d[1].put(H[3].f45b, d.b(iArr[3], this.f21f)); } cVar.c((short) i16); cVar.write(P); if (this.f21f == ByteOrder.BIG_ENDIAN) { s10 = 19789; } else { s10 = 18761; } cVar.c(s10); cVar.f40t = this.f21f; cVar.c((short) 42); cVar.b((int) 8); for (int i18 = 0; i18 < G.length; i18++) { if (!this.f19d[i18].isEmpty()) { cVar.c((short) this.f19d[i18].size()); int size = (this.f19d[i18].size() * 12) + iArr[i18] + 2 + 4; for (Map.Entry<String, d> entry2 : this.f19d[i18].entrySet()) { int i19 = L[i18].get(entry2.getKey()).f44a; d value2 = entry2.getValue(); value2.getClass(); int i20 = D[value2.f41a] * value2.f42b; cVar.c((short) i19); cVar.c((short) value2.f41a); cVar.b(value2.f42b); if (i20 > 4) { cVar.b(size); size += i20; } else { cVar.write(value2.f43c); if (i20 < 4) { while (i20 < 4) { cVar.a(0); i20++; } } } } if (i18 == 0 && !this.f19d[4].isEmpty()) { cVar.b(iArr[4]); } else { cVar.b((int) 0); } Iterator<Map.Entry<String, d>> it2 = this.f19d[i18].entrySet().iterator(); while (it2.hasNext()) { byte[] bArr = it2.next().getValue().f43c; if (bArr.length > 4) { cVar.write(bArr, 0, bArr.length); } } } } if (this.f22g) { cVar.write(m()); } cVar.f40t = ByteOrder.BIG_ENDIAN; byte[] bArr2 = new byte[4096]; while (dataInputStream.readByte() == -1) { byte readByte = dataInputStream.readByte(); if (readByte != -39 && readByte != -38) { if (readByte != -31) { cVar.a(-1); cVar.a(readByte); int readUnsignedShort = dataInputStream.readUnsignedShort(); cVar.c((short) readUnsignedShort); int i21 = readUnsignedShort - 2; if (i21 >= 0) { while (i21 > 0) { int read = dataInputStream.read(bArr2, 0, Math.min(i21, 4096)); if (read >= 0) { cVar.write(bArr2, 0, read); i21 -= read; } } } else { throw new IOException("Invalid length"); } } else { int readUnsignedShort2 = dataInputStream.readUnsignedShort() - 2; if (readUnsignedShort2 >= 0) { byte[] bArr3 = new byte[6]; if (readUnsignedShort2 >= 6) { if (dataInputStream.read(bArr3) == 6) { if (Arrays.equals(bArr3, P)) { int i22 = readUnsignedShort2 - 6; if (dataInputStream.skipBytes(i22) != i22) { throw new IOException("Invalid length"); } } } else { throw new IOException("Invalid exif"); } } cVar.a(-1); cVar.a(readByte); cVar.c((short) (readUnsignedShort2 + 2)); if (readUnsignedShort2 >= 6) { readUnsignedShort2 -= 6; cVar.write(bArr3); } while (readUnsignedShort2 > 0) { int read2 = dataInputStream.read(bArr2, 0, Math.min(readUnsignedShort2, 4096)); if (read2 >= 0) { cVar.write(bArr2, 0, read2); readUnsignedShort2 -= read2; } } } else { throw new IOException("Invalid length"); } } } else { cVar.a(-1); cVar.a(readByte); byte[] bArr4 = new byte[8192]; while (true) { int read3 = dataInputStream.read(bArr4); if (read3 != -1) { cVar.write(bArr4, 0, read3); } else { return; } } } } throw new IOException("Invalid marker"); } throw new IOException("Invalid marker"); } throw new IOException("Invalid marker"); } public final void y(String str, String str2) { String str3; e eVar; int i10; int i11; d dVar; String str4 = str2; if ("ISOSpeedRatings".equals(str)) { str3 = "PhotographicSensitivity"; } else { str3 = str; } int i12 = 2; int i13 = 1; if (str4 != null && M.contains(str3)) { if (str3.equals("GPSTimeStamp")) { Matcher matcher = R.matcher(str4); if (!matcher.find()) { return; } str4 = Integer.parseInt(matcher.group(1)) + "/1," + Integer.parseInt(matcher.group(2)) + "/1," + Integer.parseInt(matcher.group(3)) + "/1"; } else { try { str4 = ((long) (Double.parseDouble(str2) * 10000.0d)) + "/10000"; } catch (NumberFormatException unused) { return; } } } int i14 = 0; int i15 = 0; while (i15 < G.length) { if ((i15 != 4 || this.f22g) && (eVar = L[i15].get(str3)) != null) { if (str4 == null) { this.f19d[i15].remove(str3); } else { Pair<Integer, Integer> n10 = n(str4); if (eVar.f46c != ((Integer) n10.first).intValue() && eVar.f46c != ((Integer) n10.second).intValue()) { int i16 = eVar.f47d; if (i16 != -1 && (i16 == ((Integer) n10.first).intValue() || eVar.f47d == ((Integer) n10.second).intValue())) { i10 = eVar.f47d; } else { int i17 = eVar.f46c; if (i17 != i13 && i17 != 7 && i17 != i12) { if (f8r) { String[] strArr = C; String str5 = strArr[i17]; int i18 = eVar.f47d; if (i18 != -1) { String str6 = strArr[i18]; } String str7 = strArr[((Integer) n10.first).intValue()]; if (((Integer) n10.second).intValue() != -1) { String str8 = strArr[((Integer) n10.second).intValue()]; } } } else { i10 = i17; } } } else { i10 = eVar.f46c; } switch (i10) { case 1: i11 = i15; HashMap<String, d> hashMap = this.f19d[i11]; if (str4.length() == 1 && str4.charAt(0) >= '0' && str4.charAt(0) <= '1') { dVar = new d(new byte[]{(byte) (str4.charAt(0) - '0')}, 1, 1, 0); } else { byte[] bytes = str4.getBytes(O); dVar = new d(bytes, 1, bytes.length, 0); } hashMap.put(str3, dVar); break; case 2: case 7: i11 = i15; this.f19d[i11].put(str3, d.a(str4)); break; case 3: i11 = i15; String[] split = str4.split(",", -1); int[] iArr = new int[split.length]; for (int i19 = 0; i19 < split.length; i19++) { iArr[i19] = Integer.parseInt(split[i19]); } this.f19d[i11].put(str3, d.f(iArr, this.f21f)); break; case 4: i11 = i15; String[] split2 = str4.split(",", -1); long[] jArr = new long[split2.length]; for (int i20 = 0; i20 < split2.length; i20++) { jArr[i20] = Long.parseLong(split2[i20]); } this.f19d[i11].put(str3, d.c(jArr, this.f21f)); break; case 5: i11 = i15; String[] split3 = str4.split(",", -1); f[] fVarArr = new f[split3.length]; for (int i21 = 0; i21 < split3.length; i21++) { String[] split4 = split3[i21].split("/", -1); fVarArr[i21] = new f((long) Double.parseDouble(split4[0]), (long) Double.parseDouble(split4[1])); } this.f19d[i11].put(str3, d.d(fVarArr, this.f21f)); break; case 9: i11 = i15; String[] split5 = str4.split(",", -1); int length = split5.length; int[] iArr2 = new int[length]; for (int i22 = 0; i22 < split5.length; i22++) { iArr2[i22] = Integer.parseInt(split5[i22]); } HashMap<String, d> hashMap2 = this.f19d[i11]; ByteOrder byteOrder = this.f21f; ByteBuffer wrap = ByteBuffer.wrap(new byte[D[9] * length]); wrap.order(byteOrder); for (int i23 = 0; i23 < length; i23++) { wrap.putInt(iArr2[i23]); } hashMap2.put(str3, new d(wrap.array(), 9, length, 0)); break; case 10: String[] split6 = str4.split(",", -1); int length2 = split6.length; f[] fVarArr2 = new f[length2]; int i24 = 0; while (i24 < split6.length) { String[] split7 = split6[i24].split("/", -1); fVarArr2[i24] = new f((long) Double.parseDouble(split7[i14]), (long) Double.parseDouble(split7[i13])); i24++; i15 = i15; i13 = 1; i14 = 0; } i11 = i15; HashMap<String, d> hashMap3 = this.f19d[i11]; ByteOrder byteOrder2 = this.f21f; ByteBuffer wrap2 = ByteBuffer.wrap(new byte[D[10] * length2]); wrap2.order(byteOrder2); for (int i25 = 0; i25 < length2; i25++) { f fVar = fVarArr2[i25]; wrap2.putInt((int) fVar.f48a); wrap2.putInt((int) fVar.f49b); } hashMap3.put(str3, new d(wrap2.array(), 10, length2, 0)); break; case 12: String[] split8 = str4.split(",", -1); int length3 = split8.length; double[] dArr = new double[length3]; for (int i26 = 0; i26 < split8.length; i26++) { dArr[i26] = Double.parseDouble(split8[i26]); } HashMap<String, d> hashMap4 = this.f19d[i15]; ByteOrder byteOrder3 = this.f21f; ByteBuffer wrap3 = ByteBuffer.wrap(new byte[D[12] * length3]); wrap3.order(byteOrder3); for (int i27 = 0; i27 < length3; i27++) { wrap3.putDouble(dArr[i27]); } hashMap4.put(str3, new d(wrap3.array(), 12, length3, i14)); break; } i15 = i11 + 1; i12 = 2; i13 = 1; i14 = 0; } } i11 = i15; i15 = i11 + 1; i12 = 2; i13 = 1; i14 = 0; } } public final void z(C0002b c0002b) throws IOException { boolean z10; d dVar; int h10; HashMap<String, d> hashMap = this.f19d[4]; d dVar2 = hashMap.get("Compression"); if (dVar2 != null) { int h11 = dVar2.h(this.f21f); this.f25k = h11; if (h11 != 1) { if (h11 != 6) { if (h11 != 7) { return; } } else { o(c0002b, hashMap); return; } } d dVar3 = hashMap.get("BitsPerSample"); if (dVar3 != null) { int[] iArr = (int[]) dVar3.j(this.f21f); int[] iArr2 = f11u; if (Arrays.equals(iArr2, iArr) || (this.f18c == 3 && (dVar = hashMap.get("PhotometricInterpretation")) != null && (((h10 = dVar.h(this.f21f)) == 1 && Arrays.equals(iArr, v)) || (h10 == 6 && Arrays.equals(iArr, iArr2))))) { z10 = true; if (!z10) { d dVar4 = hashMap.get("StripOffsets"); d dVar5 = hashMap.get("StripByteCounts"); if (dVar4 != null && dVar5 != null) { long[] c10 = c(dVar4.j(this.f21f)); long[] c11 = c(dVar5.j(this.f21f)); if (c10 != null && c11 != null) { long j = 0; for (long j10 : c11) { j += j10; } int i10 = (int) j; byte[] bArr = new byte[i10]; int i11 = 0; int i12 = 0; for (int i13 = 0; i13 < c10.length; i13++) { int i14 = (int) c10[i13]; int i15 = (int) c11[i13]; int i16 = i14 - i11; c0002b.a(i16); int i17 = i11 + i16; byte[] bArr2 = new byte[i15]; c0002b.read(bArr2); i11 = i17 + i15; System.arraycopy(bArr2, 0, bArr, i12, i15); i12 += i15; } this.f22g = true; this.j = bArr; this.f24i = i10; return; } return; } return; } return; } } z10 = false; if (!z10) { } } else { this.f25k = 6; o(c0002b, hashMap); } } public static class C0002b extends InputStream implements DataInput { public static final ByteOrder f34w = ByteOrder.LITTLE_ENDIAN; public static final ByteOrder f35x = ByteOrder.BIG_ENDIAN; public DataInputStream f36s; public ByteOrder f37t; public final int f38u; public int v; public C0002b(InputStream inputStream) throws IOException { this.f37t = ByteOrder.BIG_ENDIAN; DataInputStream dataInputStream = new DataInputStream(inputStream); this.f36s = dataInputStream; int available = dataInputStream.available(); this.f38u = available; this.v = 0; this.f36s.mark(available); } public final void a(long j) throws IOException { int i10 = this.v; if (i10 > j) { this.v = 0; this.f36s.reset(); this.f36s.mark(this.f38u); } else { j -= i10; } int i11 = (int) j; if (skipBytes(i11) == i11) { } else { throw new IOException("Couldn't seek up to the byteCount"); } } @Override public final int available() throws IOException { return this.f36s.available(); } @Override public final int read() throws IOException { this.v++; return this.f36s.read(); } @Override public final boolean readBoolean() throws IOException { this.v++; return this.f36s.readBoolean(); } @Override public final byte readByte() throws IOException { int i10 = this.v + 1; this.v = i10; if (i10 <= this.f38u) { int read = this.f36s.read(); if (read >= 0) { return (byte) read; } throw new EOFException(); } throw new EOFException(); } @Override public final char readChar() throws IOException { this.v += 2; return this.f36s.readChar(); } @Override public final double readDouble() throws IOException { return Double.longBitsToDouble(readLong()); } @Override public final float readFloat() throws IOException { return Float.intBitsToFloat(readInt()); } @Override public final void readFully(byte[] bArr, int i10, int i11) throws IOException { int i12 = this.v + i11; this.v = i12; if (i12 <= this.f38u) { if (this.f36s.read(bArr, i10, i11) != i11) { throw new IOException("Couldn't read up to the length of buffer"); } return; } throw new EOFException(); } @Override public final int readInt() throws IOException { int i10 = this.v + 4; this.v = i10; if (i10 <= this.f38u) { int read = this.f36s.read(); int read2 = this.f36s.read(); int read3 = this.f36s.read(); int read4 = this.f36s.read(); if ((read | read2 | read3 | read4) >= 0) { ByteOrder byteOrder = this.f37t; if (byteOrder == f34w) { return (read4 << 24) + (read3 << 16) + (read2 << 8) + read; } if (byteOrder == f35x) { return (read << 24) + (read2 << 16) + (read3 << 8) + read4; } StringBuilder h10 = c.b.h("Invalid byte order: "); h10.append(this.f37t); throw new IOException(h10.toString()); } throw new EOFException(); } throw new EOFException(); } @Override public final String readLine() throws IOException { return null; } @Override public final long readLong() throws IOException { int i10 = this.v + 8; this.v = i10; if (i10 <= this.f38u) { int read = this.f36s.read(); int read2 = this.f36s.read(); int read3 = this.f36s.read(); int read4 = this.f36s.read(); int read5 = this.f36s.read(); int read6 = this.f36s.read(); int read7 = this.f36s.read(); int read8 = this.f36s.read(); if ((read | read2 | read3 | read4 | read5 | read6 | read7 | read8) >= 0) { ByteOrder byteOrder = this.f37t; if (byteOrder == f34w) { return (read8 << 56) + (read7 << 48) + (read6 << 40) + (read5 << 32) + (read4 << 24) + (read3 << 16) + (read2 << 8) + read; } if (byteOrder == f35x) { return (read << 56) + (read2 << 48) + (read3 << 40) + (read4 << 32) + (read5 << 24) + (read6 << 16) + (read7 << 8) + read8; } StringBuilder h10 = c.b.h("Invalid byte order: "); h10.append(this.f37t); throw new IOException(h10.toString()); } throw new EOFException(); } throw new EOFException(); } @Override public final short readShort() throws IOException { int i10 = this.v + 2; this.v = i10; if (i10 <= this.f38u) { int read = this.f36s.read(); int read2 = this.f36s.read(); if ((read | read2) >= 0) { ByteOrder byteOrder = this.f37t; if (byteOrder == f34w) { return (short) ((read2 << 8) + read); } if (byteOrder == f35x) { return (short) ((read << 8) + read2); } StringBuilder h10 = c.b.h("Invalid byte order: "); h10.append(this.f37t); throw new IOException(h10.toString()); } throw new EOFException(); } throw new EOFException(); } @Override public final String readUTF() throws IOException { this.v += 2; return this.f36s.readUTF(); } @Override public final int readUnsignedByte() throws IOException { this.v++; return this.f36s.readUnsignedByte(); } @Override public final int readUnsignedShort() throws IOException { int i10 = this.v + 2; this.v = i10; if (i10 <= this.f38u) { int read = this.f36s.read(); int read2 = this.f36s.read(); if ((read | read2) >= 0) { ByteOrder byteOrder = this.f37t; if (byteOrder == f34w) { return (read2 << 8) + read; } if (byteOrder == f35x) { return (read << 8) + read2; } StringBuilder h10 = c.b.h("Invalid byte order: "); h10.append(this.f37t); throw new IOException(h10.toString()); } throw new EOFException(); } throw new EOFException(); } @Override public final int skipBytes(int i10) throws IOException { int min = Math.min(i10, this.f38u - this.v); int i11 = 0; while (i11 < min) { i11 += this.f36s.skipBytes(min - i11); } this.v += i11; return i11; } @Override public final int read(byte[] bArr, int i10, int i11) throws IOException { int read = this.f36s.read(bArr, i10, i11); this.v += read; return read; } @Override public final void readFully(byte[] bArr) throws IOException { int length = this.v + bArr.length; this.v = length; if (length <= this.f38u) { if (this.f36s.read(bArr, 0, bArr.length) != bArr.length) { throw new IOException("Couldn't read up to the length of buffer"); } return; } throw new EOFException(); } public C0002b(byte[] bArr) throws IOException { this(new ByteArrayInputStream(bArr)); } } public static class e { public final int f44a; public final String f45b; public final int f46c; public final int f47d; public e(String str, int i10, int i11) { this.f45b = str; this.f44a = i10; this.f46c = i11; this.f47d = -1; } public e(int i10, String str) { this.f45b = str; this.f44a = i10; this.f46c = 3; this.f47d = 4; } } }