91快播 v3.3.0版本的 MD5 值为:094b9519ad2388a8147509cb8a126145

以下内容为反编译后的 C0285.java 源代码,内容仅作参考


package anta.Ÿ;

import android.content.res.AssetManager;
import android.media.MediaDataSource;
import android.media.MediaMetadataRetriever;
import android.system.Os;
import android.system.OsConstants;
import android.util.Log;
import anta.㮌.C9125;
import com.shuyu.gsyvideoplayer.utils.NeuQuant;
import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.DataInput;
import java.io.DataInputStream;
import java.io.EOFException;
import java.io.FileDescriptor;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
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.Map;
import java.util.Objects;
import java.util.Set;
import java.util.TimeZone;
import java.util.regex.Pattern;
import java.util.zip.CRC32;
public class C0285 {
    public static final HashMap<String, C0290>[] f1369;
    public static final C0290[] f1370;
    public static final C0290[] f1371;
    public static final HashSet<String> f1372;
    public static final byte[] f1373;
    public static SimpleDateFormat f1374;
    public static final byte[] f1375;
    public static final C0290[] f1376;
    public static final C0290[] f1377;
    public static final HashMap<Integer, Integer> f1378;
    public static final byte[] f1379;
    public static final C0290[][] f1380;
    public static final int[] f1381;
    public static final C0290[] f1382;
    public static final byte[] f1383;
    public static final HashMap<Integer, C0290>[] f1384;
    public static final byte[] f1385;
    public static final byte[] f1386;
    public static final byte[] f1387;
    public static final C0290[] f1388;
    public static final byte[] f1389;
    public static final byte[] f1390;
    public static final byte[] f1391;
    public static final String[] f1392;
    public static final C0290[] f1393;
    public static final byte[] f1394;
    public static final int[] f1395;
    public static final byte[] f1396;
    public static final boolean f1397 = Log.isLoggable("ExifInterface", 3);
    public static final C0290[] f1398;
    public static final byte[] f1399;
    public static final int[] f1400;
    public static final byte[] f1401;
    public static final C0290[] f1402;
    public static final byte[] f1403;
    public static final C0290[] f1404;
    public static final C0290 f1405;
    public static final byte[] f1406;
    public static final Charset f1407;
    public int f1408;
    public FileDescriptor f1409;
    public int f1410;
    public int f1411;
    public int f1412;
    public final HashMap<String, C0287>[] f1413;
    public int f1414;
    public int f1415;
    public int f1416;
    public AssetManager.AssetInputStream f1417;
    public int f1418;
    public boolean f1419;
    public int f1420;
    public boolean f1421;
    public Set<Integer> f1422;
    public ByteOrder f1423;

    public class C0286 extends MediaDataSource {
        public long f1424;
        public final C0289 f1425;

        public C0286(C0285 c0285, C0289 c0289) {
            this.f1425 = c0289;
        }

        @Override
        public void close() {
        }

        @Override
        public long getSize() {
            return -1L;
        }

        @Override
        public int readAt(long j, byte[] bArr, int i, int i2) {
            if (i2 == 0) {
                return 0;
            }
            if (j < 0) {
                return -1;
            }
            try {
                long j2 = this.f1424;
                if (j2 != j) {
                    if (j2 >= 0 && j >= j2 + this.f1425.available()) {
                        return -1;
                    }
                    this.f1425.m637(j);
                    this.f1424 = j;
                }
                if (i2 > this.f1425.available()) {
                    i2 = this.f1425.available();
                }
                C0289 c0289 = this.f1425;
                int read = c0289.f1435.read(bArr, i, i2);
                c0289.f1433 += read;
                if (read >= 0) {
                    this.f1424 += read;
                    return read;
                }
            } catch (IOException unused) {
            }
            this.f1424 = -1L;
            return -1;
        }
    }

    public static class C0288 {
        public final long f1429;
        public final long f1430;

        public C0288(long j, long j2) {
            if (j2 == 0) {
                this.f1429 = 0L;
                this.f1430 = 1L;
                return;
            }
            this.f1429 = j;
            this.f1430 = j2;
        }

        public String toString() {
            return this.f1429 + "/" + this.f1430;
        }
    }

    static {
        C0290[] c0290Arr;
        Arrays.asList(1, 6, 3, 8);
        Arrays.asList(2, 7, 4, 5);
        f1400 = new int[]{8, 8, 8};
        f1395 = new int[]{8};
        f1390 = new byte[]{-1, -40, -1};
        f1389 = new byte[]{102, 116, 121, 112};
        f1401 = new byte[]{109, 105, 102, 49};
        f1391 = new byte[]{104, 101, 105, 99};
        f1394 = new byte[]{79, 76, 89, 77, 80, 0};
        f1387 = new byte[]{79, 76, 89, 77, 80, 85, 83, 0, 73, 73};
        f1373 = new byte[]{-119, 80, 78, 71, 13, 10, 26, 10};
        f1399 = new byte[]{101, 88, 73, 102};
        f1396 = new byte[]{73, 72, 68, 82};
        f1383 = new byte[]{73, 69, 78, 68};
        f1385 = new byte[]{82, 73, 70, 70};
        f1406 = new byte[]{87, 69, 66, 80};
        f1375 = new byte[]{69, 88, 73, 70};
        "VP8X".getBytes(Charset.defaultCharset());
        "VP8L".getBytes(Charset.defaultCharset());
        "VP8 ".getBytes(Charset.defaultCharset());
        "ANIM".getBytes(Charset.defaultCharset());
        "ANMF".getBytes(Charset.defaultCharset());
        "XMP ".getBytes(Charset.defaultCharset());
        f1392 = new String[]{"", "BYTE", "STRING", "USHORT", "ULONG", "URATIONAL", "SBYTE", "UNDEFINED", "SSHORT", "SLONG", "SRATIONAL", "SINGLE", "DOUBLE", "IFD"};
        f1381 = new int[]{0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8, 1};
        f1379 = new byte[]{65, 83, 67, 73, 73, 0, 0, 0};
        C0290[] c0290Arr2 = {new C0290("NewSubfileType", 254, 4), new C0290("SubfileType", NeuQuant.maxnetpos, 4), new C0290("ImageWidth", 256, 3, 4), new C0290("ImageLength", 257, 3, 4), new C0290("BitsPerSample", 258, 3), new C0290("Compression", 259, 3), new C0290("PhotometricInterpretation", 262, 3), new C0290("ImageDescription", 270, 2), new C0290("Make", 271, 2), new C0290("Model", 272, 2), new C0290("StripOffsets", 273, 3, 4), new C0290("Orientation", 274, 3), new C0290("SamplesPerPixel", 277, 3), new C0290("RowsPerStrip", 278, 3, 4), new C0290("StripByteCounts", 279, 3, 4), new C0290("XResolution", 282, 5), new C0290("YResolution", 283, 5), new C0290("PlanarConfiguration", 284, 3), new C0290("ResolutionUnit", 296, 3), new C0290("TransferFunction", 301, 3), new C0290("Software", 305, 2), new C0290("DateTime", 306, 2), new C0290("Artist", 315, 2), new C0290("WhitePoint", 318, 5), new C0290("PrimaryChromaticities", 319, 5), new C0290("SubIFDPointer", 330, 4), new C0290("JPEGInterchangeFormat", 513, 4), new C0290("JPEGInterchangeFormatLength", 514, 4), new C0290("YCbCrCoefficients", 529, 5), new C0290("YCbCrSubSampling", 530, 3), new C0290("YCbCrPositioning", 531, 3), new C0290("ReferenceBlackWhite", 532, 5), new C0290("Copyright", 33432, 2), new C0290("ExifIFDPointer", 34665, 4), new C0290("GPSInfoIFDPointer", 34853, 4), new C0290("SensorTopBorder", 4, 4), new C0290("SensorLeftBorder", 5, 4), new C0290("SensorBottomBorder", 6, 4), new C0290("SensorRightBorder", 7, 4), new C0290("ISO", 23, 3), new C0290("JpgFromRaw", 46, 7), new C0290("Xmp", 700, 1)};
        f1388 = c0290Arr2;
        C0290[] c0290Arr3 = {new C0290("ExposureTime", 33434, 5), new C0290("FNumber", 33437, 5), new C0290("ExposureProgram", 34850, 3), new C0290("SpectralSensitivity", 34852, 2), new C0290("PhotographicSensitivity", 34855, 3), new C0290("OECF", 34856, 7), new C0290("SensitivityType", 34864, 3), new C0290("StandardOutputSensitivity", 34865, 4), new C0290("RecommendedExposureIndex", 34866, 4), new C0290("ISOSpeed", 34867, 4), new C0290("ISOSpeedLatitudeyyy", 34868, 4), new C0290("ISOSpeedLatitudezzz", 34869, 4), new C0290("ExifVersion", 36864, 2), new C0290("DateTimeOriginal", 36867, 2), new C0290("DateTimeDigitized", 36868, 2), new C0290("OffsetTime", 36880, 2), new C0290("OffsetTimeOriginal", 36881, 2), new C0290("OffsetTimeDigitized", 36882, 2), new C0290("ComponentsConfiguration", 37121, 7), new C0290("CompressedBitsPerPixel", 37122, 5), new C0290("ShutterSpeedValue", 37377, 10), new C0290("ApertureValue", 37378, 5), new C0290("BrightnessValue", 37379, 10), new C0290("ExposureBiasValue", 37380, 10), new C0290("MaxApertureValue", 37381, 5), new C0290("SubjectDistance", 37382, 5), new C0290("MeteringMode", 37383, 3), new C0290("LightSource", 37384, 3), new C0290("Flash", 37385, 3), new C0290("FocalLength", 37386, 5), new C0290("SubjectArea", 37396, 3), new C0290("MakerNote", 37500, 7), new C0290("UserComment", 37510, 7), new C0290("SubSecTime", 37520, 2), new C0290("SubSecTimeOriginal", 37521, 2), new C0290("SubSecTimeDigitized", 37522, 2), new C0290("FlashpixVersion", 40960, 7), new C0290("ColorSpace", 40961, 3), new C0290("PixelXDimension", 40962, 3, 4), new C0290("PixelYDimension", 40963, 3, 4), new C0290("RelatedSoundFile", 40964, 2), new C0290("InteroperabilityIFDPointer", 40965, 4), new C0290("FlashEnergy", 41483, 5), new C0290("SpatialFrequencyResponse", 41484, 7), new C0290("FocalPlaneXResolution", 41486, 5), new C0290("FocalPlaneYResolution", 41487, 5), new C0290("FocalPlaneResolutionUnit", 41488, 3), new C0290("SubjectLocation", 41492, 3), new C0290("ExposureIndex", 41493, 5), new C0290("SensingMethod", 41495, 3), new C0290("FileSource", 41728, 7), new C0290("SceneType", 41729, 7), new C0290("CFAPattern", 41730, 7), new C0290("CustomRendered", 41985, 3), new C0290("ExposureMode", 41986, 3), new C0290("WhiteBalance", 41987, 3), new C0290("DigitalZoomRatio", 41988, 5), new C0290("FocalLengthIn35mmFilm", 41989, 3), new C0290("SceneCaptureType", 41990, 3), new C0290("GainControl", 41991, 3), new C0290("Contrast", 41992, 3), new C0290("Saturation", 41993, 3), new C0290("Sharpness", 41994, 3), new C0290("DeviceSettingDescription", 41995, 7), new C0290("SubjectDistanceRange", 41996, 3), new C0290("ImageUniqueID", 42016, 2), new C0290("CameraOwnerName", 42032, 2), new C0290("BodySerialNumber", 42033, 2), new C0290("LensSpecification", 42034, 5), new C0290("LensMake", 42035, 2), new C0290("LensModel", 42036, 2), new C0290("Gamma", 42240, 5), new C0290("DNGVersion", 50706, 1), new C0290("DefaultCropSize", 50720, 3, 4)};
        f1377 = c0290Arr3;
        C0290[] c0290Arr4 = {new C0290("GPSVersionID", 0, 1), new C0290("GPSLatitudeRef", 1, 2), new C0290("GPSLatitude", 2, 5), new C0290("GPSLongitudeRef", 3, 2), new C0290("GPSLongitude", 4, 5), new C0290("GPSAltitudeRef", 5, 1), new C0290("GPSAltitude", 6, 5), new C0290("GPSTimeStamp", 7, 5), new C0290("GPSSatellites", 8, 2), new C0290("GPSStatus", 9, 2), new C0290("GPSMeasureMode", 10, 2), new C0290("GPSDOP", 11, 5), new C0290("GPSSpeedRef", 12, 2), new C0290("GPSSpeed", 13, 5), new C0290("GPSTrackRef", 14, 2), new C0290("GPSTrack", 15, 5), new C0290("GPSImgDirectionRef", 16, 2), new C0290("GPSImgDirection", 17, 5), new C0290("GPSMapDatum", 18, 2), new C0290("GPSDestLatitudeRef", 19, 2), new C0290("GPSDestLatitude", 20, 5), new C0290("GPSDestLongitudeRef", 21, 2), new C0290("GPSDestLongitude", 22, 5), new C0290("GPSDestBearingRef", 23, 2), new C0290("GPSDestBearing", 24, 5), new C0290("GPSDestDistanceRef", 25, 2), new C0290("GPSDestDistance", 26, 5), new C0290("GPSProcessingMethod", 27, 7), new C0290("GPSAreaInformation", 28, 7), new C0290("GPSDateStamp", 29, 2), new C0290("GPSDifferential", 30, 3), new C0290("GPSHPositioningError", 31, 5)};
        f1402 = c0290Arr4;
        C0290[] c0290Arr5 = {new C0290("InteroperabilityIndex", 1, 2)};
        f1398 = c0290Arr5;
        C0290[] c0290Arr6 = {new C0290("NewSubfileType", 254, 4), new C0290("SubfileType", NeuQuant.maxnetpos, 4), new C0290("ThumbnailImageWidth", 256, 3, 4), new C0290("ThumbnailImageLength", 257, 3, 4), new C0290("BitsPerSample", 258, 3), new C0290("Compression", 259, 3), new C0290("PhotometricInterpretation", 262, 3), new C0290("ImageDescription", 270, 2), new C0290("Make", 271, 2), new C0290("Model", 272, 2), new C0290("StripOffsets", 273, 3, 4), new C0290("ThumbnailOrientation", 274, 3), new C0290("SamplesPerPixel", 277, 3), new C0290("RowsPerStrip", 278, 3, 4), new C0290("StripByteCounts", 279, 3, 4), new C0290("XResolution", 282, 5), new C0290("YResolution", 283, 5), new C0290("PlanarConfiguration", 284, 3), new C0290("ResolutionUnit", 296, 3), new C0290("TransferFunction", 301, 3), new C0290("Software", 305, 2), new C0290("DateTime", 306, 2), new C0290("Artist", 315, 2), new C0290("WhitePoint", 318, 5), new C0290("PrimaryChromaticities", 319, 5), new C0290("SubIFDPointer", 330, 4), new C0290("JPEGInterchangeFormat", 513, 4), new C0290("JPEGInterchangeFormatLength", 514, 4), new C0290("YCbCrCoefficients", 529, 5), new C0290("YCbCrSubSampling", 530, 3), new C0290("YCbCrPositioning", 531, 3), new C0290("ReferenceBlackWhite", 532, 5), new C0290("Copyright", 33432, 2), new C0290("ExifIFDPointer", 34665, 4), new C0290("GPSInfoIFDPointer", 34853, 4), new C0290("DNGVersion", 50706, 1), new C0290("DefaultCropSize", 50720, 3, 4)};
        f1382 = c0290Arr6;
        f1405 = new C0290("StripOffsets", 273, 3);
        C0290[] c0290Arr7 = {new C0290("ThumbnailImage", 256, 7), new C0290("CameraSettingsIFDPointer", 8224, 4), new C0290("ImageProcessingIFDPointer", 8256, 4)};
        f1404 = c0290Arr7;
        C0290[] c0290Arr8 = {new C0290("PreviewImageStart", 257, 4), new C0290("PreviewImageLength", 258, 4)};
        f1376 = c0290Arr8;
        C0290[] c0290Arr9 = {new C0290("AspectFrame", 4371, 3)};
        f1393 = c0290Arr9;
        C0290[] c0290Arr10 = {new C0290("ColorSpace", 55, 3)};
        f1370 = c0290Arr10;
        C0290[][] c0290Arr11 = {c0290Arr2, c0290Arr3, c0290Arr4, c0290Arr5, c0290Arr6, c0290Arr2, c0290Arr7, c0290Arr8, c0290Arr9, c0290Arr10};
        f1380 = c0290Arr11;
        f1371 = new C0290[]{new C0290("SubIFDPointer", 330, 4), new C0290("ExifIFDPointer", 34665, 4), new C0290("GPSInfoIFDPointer", 34853, 4), new C0290("InteroperabilityIFDPointer", 40965, 4), new C0290("CameraSettingsIFDPointer", 8224, 1), new C0290("ImageProcessingIFDPointer", 8256, 1)};
        f1384 = new HashMap[c0290Arr11.length];
        f1369 = new HashMap[c0290Arr11.length];
        f1372 = new HashSet<>(Arrays.asList("FNumber", "DigitalZoomRatio", "ExposureTime", "SubjectDistance", "GPSTimeStamp"));
        f1378 = new HashMap<>();
        Charset forName = Charset.forName("US-ASCII");
        f1407 = forName;
        f1403 = "Exif\u0000\u0000".getBytes(forName);
        f1386 = "http://ns.adobe.com/xap/1.0/\u0000".getBytes(forName);
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy:MM:dd HH:mm:ss");
        f1374 = simpleDateFormat;
        simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
        int i = 0;
        while (true) {
            C0290[][] c0290Arr12 = f1380;
            if (i < c0290Arr12.length) {
                f1384[i] = new HashMap<>();
                f1369[i] = new HashMap<>();
                for (C0290 c0290 : c0290Arr12[i]) {
                    f1384[i].put(Integer.valueOf(c0290.f1437), c0290);
                    f1369[i].put(c0290.f1439, c0290);
                }
                i++;
            } else {
                HashMap<Integer, Integer> hashMap = f1378;
                C0290[] c0290Arr13 = f1371;
                hashMap.put(Integer.valueOf(c0290Arr13[0].f1437), 5);
                hashMap.put(Integer.valueOf(c0290Arr13[1].f1437), 1);
                hashMap.put(Integer.valueOf(c0290Arr13[2].f1437), 2);
                hashMap.put(Integer.valueOf(c0290Arr13[3].f1437), 3);
                hashMap.put(Integer.valueOf(c0290Arr13[4].f1437), 7);
                hashMap.put(Integer.valueOf(c0290Arr13[5].f1437), 8);
                Pattern.compile(".*[1-9].*");
                Pattern.compile("^([0-9][0-9]):([0-9][0-9]):([0-9][0-9])$");
                return;
            }
        }
    }

    public C0285(InputStream inputStream) {
        boolean z;
        C0290[][] c0290Arr = f1380;
        this.f1413 = new HashMap[c0290Arr.length];
        this.f1422 = new HashSet(c0290Arr.length);
        this.f1423 = ByteOrder.BIG_ENDIAN;
        Objects.requireNonNull(inputStream, "inputStream cannot be null");
        if (inputStream instanceof AssetManager.AssetInputStream) {
            this.f1417 = (AssetManager.AssetInputStream) inputStream;
            this.f1409 = null;
        } else {
            if (inputStream instanceof FileInputStream) {
                FileInputStream fileInputStream = (FileInputStream) inputStream;
                try {
                    Os.lseek(fileInputStream.getFD(), 0L, OsConstants.SEEK_CUR);
                    z = true;
                } catch (Exception unused) {
                    if (f1397) {
                        Log.d("ExifInterface", "The file descriptor for the given input is not seekable");
                    }
                    z = false;
                }
                if (z) {
                    this.f1417 = null;
                    this.f1409 = fileInputStream.getFD();
                }
            }
            this.f1417 = null;
            this.f1409 = null;
        }
        for (int i = 0; i < f1380.length; i++) {
            try {
                try {
                    this.f1413[i] = new HashMap<>();
                } catch (IOException e) {
                    boolean z2 = f1397;
                    if (z2) {
                        Log.w("ExifInterface", "Invalid image: ExifInterface got an unsupported image format file(ExifInterface supports JPEG and some RAW image formats only) or a corrupted JPEG file to ExifInterface.", e);
                    }
                    m605();
                    if (!z2) {
                        return;
                    }
                }
            } finally {
                m605();
                if (f1397) {
                    m619();
                }
            }
        }
        if (!this.f1419) {
            BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream, 5000);
            this.f1410 = m622(bufferedInputStream);
            inputStream = bufferedInputStream;
        }
        C0289 c0289 = new C0289(inputStream);
        if (!this.f1419) {
            switch (this.f1410) {
                case 0:
                case 1:
                case 2:
                case 3:
                case 5:
                case 6:
                case 8:
                case 11:
                    m620(c0289);
                    break;
                case 4:
                    m627(c0289, 0, 0);
                    break;
                case 7:
                    m607(c0289);
                    break;
                case 9:
                    m617(c0289);
                    break;
                case 10:
                    m604(c0289);
                    break;
                case 12:
                    m624(c0289);
                    break;
                case 13:
                    m615(c0289);
                    break;
                case 14:
                    m608(c0289);
                    break;
            }
        } else {
            m611(c0289);
        }
        m616(c0289);
    }

    public static long[] m601(Object obj) {
        if (obj instanceof int[]) {
            int[] iArr = (int[]) obj;
            long[] jArr = new long[iArr.length];
            for (int i = 0; i < iArr.length; i++) {
                jArr[i] = iArr[i];
            }
            return jArr;
        } else if (obj instanceof long[]) {
            return (long[]) obj;
        } else {
            return null;
        }
    }

    public static String m602(byte[] bArr) {
        StringBuilder sb = new StringBuilder(bArr.length * 2);
        for (int i = 0; i < bArr.length; i++) {
            sb.append(String.format("%02x", Byte.valueOf(bArr[i])));
        }
        return sb.toString();
    }

    public static boolean m603(byte[] bArr, byte[] bArr2) {
        if (bArr2 != null && bArr.length >= bArr2.length) {
            for (int i = 0; i < bArr2.length; i++) {
                if (bArr[i] != bArr2[i]) {
                    return false;
                }
            }
            return true;
        }
        return false;
    }

    public final void m604(C0289 c0289) {
        m620(c0289);
        if (this.f1413[0].get("JpgFromRaw") != null) {
            m627(c0289, this.f1414, 5);
        }
        C0287 c0287 = this.f1413[0].get("ISO");
        C0287 c02872 = this.f1413[1].get("PhotographicSensitivity");
        if (c0287 == null || c02872 != null) {
            return;
        }
        this.f1413[1].put("PhotographicSensitivity", c0287);
    }

    public final void m605() {
        String m618 = m618("DateTimeOriginal");
        if (m618 != null && m618("DateTime") == null) {
            this.f1413[0].put("DateTime", C0287.m628(m618));
        }
        if (m618("ImageWidth") == null) {
            this.f1413[0].put("ImageWidth", C0287.m630(0L, this.f1423));
        }
        if (m618("ImageLength") == null) {
            this.f1413[0].put("ImageLength", C0287.m630(0L, this.f1423));
        }
        if (m618("Orientation") == null) {
            this.f1413[0].put("Orientation", C0287.m630(0L, this.f1423));
        }
        if (m618("LightSource") == null) {
            this.f1413[1].put("LightSource", C0287.m630(0L, this.f1423));
        }
    }

    public final void m606(C0289 c0289, int i) {
        C0287 c0287;
        C0287 m631;
        C0287 m6312;
        C0287 c02872 = this.f1413[i].get("DefaultCropSize");
        C0287 c02873 = this.f1413[i].get("SensorTopBorder");
        C0287 c02874 = this.f1413[i].get("SensorLeftBorder");
        C0287 c02875 = this.f1413[i].get("SensorBottomBorder");
        C0287 c02876 = this.f1413[i].get("SensorRightBorder");
        if (c02872 != null) {
            if (c02872.f1426 == 5) {
                C0288[] c0288Arr = (C0288[]) c02872.m633(this.f1423);
                if (c0288Arr != null && c0288Arr.length == 2) {
                    m631 = C0287.m629(c0288Arr[0], this.f1423);
                    m6312 = C0287.m629(c0288Arr[1], this.f1423);
                } else {
                    StringBuilder m8071 = C9125.m8071("Invalid crop size values. cropSize=");
                    m8071.append(Arrays.toString(c0288Arr));
                    Log.w("ExifInterface", m8071.toString());
                    return;
                }
            } else {
                int[] iArr = (int[]) c02872.m633(this.f1423);
                if (iArr != null && iArr.length == 2) {
                    m631 = C0287.m631(iArr[0], this.f1423);
                    m6312 = C0287.m631(iArr[1], this.f1423);
                } else {
                    StringBuilder m80712 = C9125.m8071("Invalid crop size values. cropSize=");
                    m80712.append(Arrays.toString(iArr));
                    Log.w("ExifInterface", m80712.toString());
                    return;
                }
            }
            this.f1413[i].put("ImageWidth", m631);
            this.f1413[i].put("ImageLength", m6312);
        } else if (c02873 != null && c02874 != null && c02875 != null && c02876 != null) {
            int m634 = c02873.m634(this.f1423);
            int m6342 = c02875.m634(this.f1423);
            int m6343 = c02876.m634(this.f1423);
            int m6344 = c02874.m634(this.f1423);
            if (m6342 <= m634 || m6343 <= m6344) {
                return;
            }
            C0287 m6313 = C0287.m631(m6342 - m634, this.f1423);
            C0287 m6314 = C0287.m631(m6343 - m6344, this.f1423);
            this.f1413[i].put("ImageLength", m6313);
            this.f1413[i].put("ImageWidth", m6314);
        } else {
            C0287 c02877 = this.f1413[i].get("ImageLength");
            C0287 c02878 = this.f1413[i].get("ImageWidth");
            if ((c02877 == null || c02878 == null) && (c0287 = this.f1413[i].get("JPEGInterchangeFormat")) != null) {
                m627(c0289, c0287.m634(this.f1423), i);
            }
        }
    }

    public final void m607(C0289 c0289) {
        m620(c0289);
        C0287 c0287 = this.f1413[1].get("MakerNote");
        if (c0287 != null) {
            C0289 c02892 = new C0289(c0287.f1427);
            c02892.f1436 = this.f1423;
            byte[] bArr = f1394;
            byte[] bArr2 = new byte[bArr.length];
            c02892.readFully(bArr2);
            c02892.m637(0L);
            byte[] bArr3 = f1387;
            byte[] bArr4 = new byte[bArr3.length];
            c02892.readFully(bArr4);
            if (Arrays.equals(bArr2, bArr)) {
                c02892.m637(8L);
            } else if (Arrays.equals(bArr4, bArr3)) {
                c02892.m637(12L);
            }
            m626(c02892, 6);
            C0287 c02872 = this.f1413[7].get("PreviewImageStart");
            C0287 c02873 = this.f1413[7].get("PreviewImageLength");
            if (c02872 != null && c02873 != null) {
                this.f1413[5].put("JPEGInterchangeFormat", c02872);
                this.f1413[5].put("JPEGInterchangeFormatLength", c02873);
            }
            C0287 c02874 = this.f1413[8].get("AspectFrame");
            if (c02874 != null) {
                int[] iArr = (int[]) c02874.m633(this.f1423);
                if (iArr != null && iArr.length == 4) {
                    if (iArr[2] <= iArr[0] || iArr[3] <= iArr[1]) {
                        return;
                    }
                    int i = (iArr[2] - iArr[0]) + 1;
                    int i2 = (iArr[3] - iArr[1]) + 1;
                    if (i < i2) {
                        int i3 = i + i2;
                        i2 = i3 - i2;
                        i = i3 - i2;
                    }
                    C0287 m631 = C0287.m631(i, this.f1423);
                    C0287 m6312 = C0287.m631(i2, this.f1423);
                    this.f1413[0].put("ImageWidth", m631);
                    this.f1413[0].put("ImageLength", m6312);
                    return;
                }
                StringBuilder m8071 = C9125.m8071("Invalid aspect frame values. frame=");
                m8071.append(Arrays.toString(iArr));
                Log.w("ExifInterface", m8071.toString());
            }
        }
    }

    public final void m608(C0289 c0289) {
        if (f1397) {
            Log.d("ExifInterface", "getWebpAttributes starting with: " + c0289);
        }
        c0289.f1436 = ByteOrder.LITTLE_ENDIAN;
        c0289.skipBytes(f1385.length);
        int readInt = c0289.readInt() + 8;
        int skipBytes = c0289.skipBytes(f1406.length) + 8;
        while (true) {
            try {
                byte[] bArr = new byte[4];
                if (c0289.read(bArr) == 4) {
                    int readInt2 = c0289.readInt();
                    int i = skipBytes + 4 + 4;
                    if (Arrays.equals(f1375, bArr)) {
                        byte[] bArr2 = new byte[readInt2];
                        if (c0289.read(bArr2) == readInt2) {
                            this.f1420 = i;
                            m613(bArr2, 0);
                            this.f1420 = i;
                            return;
                        }
                        throw new IOException("Failed to read given length for given PNG chunk type: " + m602(bArr));
                    }
                    if (readInt2 % 2 == 1) {
                        readInt2++;
                    }
                    int i2 = i + readInt2;
                    if (i2 == readInt) {
                        return;
                    }
                    if (i2 <= readInt) {
                        int skipBytes2 = c0289.skipBytes(readInt2);
                        if (skipBytes2 != readInt2) {
                            throw new IOException("Encountered WebP file with invalid chunk size");
                        }
                        skipBytes = i + skipBytes2;
                    } else {
                        throw new IOException("Encountered WebP file with invalid chunk size");
                    }
                } else {
                    throw new IOException("Encountered invalid length while parsing WebP chunktype");
                }
            } catch (EOFException unused) {
                throw new IOException("Encountered corrupt WebP file.");
            }
        }
    }

    public final C0287 m609(String str) {
        if ("ISOSpeedRatings".equals(str)) {
            if (f1397) {
                Log.d("ExifInterface", "getExifAttribute: Replacing TAG_ISO_SPEED_RATINGS with TAG_PHOTOGRAPHIC_SENSITIVITY.");
            }
            str = "PhotographicSensitivity";
        }
        for (int i = 0; i < f1380.length; i++) {
            C0287 c0287 = this.f1413[i].get(str);
            if (c0287 != null) {
                return c0287;
            }
        }
        return null;
    }

    public final void m610(C0289 c0289, HashMap hashMap) {
        C0287 c0287 = (C0287) hashMap.get("JPEGInterchangeFormat");
        C0287 c02872 = (C0287) hashMap.get("JPEGInterchangeFormatLength");
        if (c0287 == null || c02872 == null) {
            return;
        }
        int m634 = c0287.m634(this.f1423);
        int m6342 = c02872.m634(this.f1423);
        if (this.f1410 == 7) {
            m634 += this.f1408;
        }
        int min = Math.min(m6342, c0289.f1434 - m634);
        if (m634 > 0 && min > 0) {
            int i = this.f1420 + m634;
            this.f1411 = i;
            this.f1416 = min;
            if (this.f1417 == null && this.f1409 == null) {
                c0289.m637(i);
                c0289.readFully(new byte[min]);
            }
        }
        if (f1397) {
            Log.d("ExifInterface", "Setting thumbnail attributes with offset: " + m634 + ", length: " + min);
        }
    }

    public final void m611(C0289 c0289) {
        byte[] bArr = f1403;
        c0289.skipBytes(bArr.length);
        byte[] bArr2 = new byte[c0289.available()];
        c0289.readFully(bArr2);
        this.f1420 = bArr.length;
        m613(bArr2, 0);
    }

    public final void m612(int i, int i2) {
        if (!this.f1413[i].isEmpty() && !this.f1413[i2].isEmpty()) {
            C0287 c0287 = this.f1413[i].get("ImageLength");
            C0287 c02872 = this.f1413[i].get("ImageWidth");
            C0287 c02873 = this.f1413[i2].get("ImageLength");
            C0287 c02874 = this.f1413[i2].get("ImageWidth");
            if (c0287 == null || c02872 == null) {
                if (f1397) {
                    Log.d("ExifInterface", "First image does not contain valid size information");
                }
            } else if (c02873 != null && c02874 != null) {
                int m634 = c0287.m634(this.f1423);
                int m6342 = c02872.m634(this.f1423);
                int m6343 = c02873.m634(this.f1423);
                int m6344 = c02874.m634(this.f1423);
                if (m634 >= m6343 || m6342 >= m6344) {
                    return;
                }
                HashMap<String, C0287>[] hashMapArr = this.f1413;
                HashMap<String, C0287> hashMap = hashMapArr[i];
                hashMapArr[i] = hashMapArr[i2];
                hashMapArr[i2] = hashMap;
            } else if (f1397) {
                Log.d("ExifInterface", "Second image does not contain valid size information");
            }
        } else if (f1397) {
            Log.d("ExifInterface", "Cannot perform swap since only one image data exists");
        }
    }

    public final void m613(byte[] bArr, int i) {
        C0289 c0289 = new C0289(bArr);
        m625(c0289, bArr.length);
        m626(c0289, i);
    }

    public final ByteOrder m614(C0289 c0289) {
        short readShort = c0289.readShort();
        if (readShort == 18761) {
            if (f1397) {
                Log.d("ExifInterface", "readExifSegment: Byte Align II");
            }
            return ByteOrder.LITTLE_ENDIAN;
        } else if (readShort == 19789) {
            if (f1397) {
                Log.d("ExifInterface", "readExifSegment: Byte Align MM");
            }
            return ByteOrder.BIG_ENDIAN;
        } else {
            StringBuilder m8071 = C9125.m8071("Invalid byte order: ");
            m8071.append(Integer.toHexString(readShort));
            throw new IOException(m8071.toString());
        }
    }

    public final void m615(C0289 c0289) {
        if (f1397) {
            Log.d("ExifInterface", "getPngAttributes starting with: " + c0289);
        }
        c0289.f1436 = ByteOrder.BIG_ENDIAN;
        byte[] bArr = f1373;
        c0289.skipBytes(bArr.length);
        int length = bArr.length + 0;
        while (true) {
            try {
                int readInt = c0289.readInt();
                int i = length + 4;
                byte[] bArr2 = new byte[4];
                if (c0289.read(bArr2) == 4) {
                    int i2 = i + 4;
                    if (i2 == 16 && !Arrays.equals(bArr2, f1396)) {
                        throw new IOException("Encountered invalid PNG file--IHDR chunk should appearas the first chunk");
                    }
                    if (Arrays.equals(bArr2, f1383)) {
                        return;
                    }
                    if (Arrays.equals(bArr2, f1399)) {
                        byte[] bArr3 = new byte[readInt];
                        if (c0289.read(bArr3) == readInt) {
                            int readInt2 = c0289.readInt();
                            CRC32 crc32 = new CRC32();
                            crc32.update(bArr2);
                            crc32.update(bArr3);
                            if (((int) crc32.getValue()) == readInt2) {
                                this.f1420 = i2;
                                m613(bArr3, 0);
                                m623();
                                return;
                            }
                            throw new IOException("Encountered invalid CRC value for PNG-EXIF chunk.\n recorded CRC value: " + readInt2 + ", calculated CRC value: " + crc32.getValue());
                        }
                        throw new IOException("Failed to read given length for given PNG chunk type: " + m602(bArr2));
                    }
                    int i3 = readInt + 4;
                    c0289.skipBytes(i3);
                    length = i2 + i3;
                } else {
                    throw new IOException("Encountered invalid length while parsing PNG chunktype");
                }
            } catch (EOFException unused) {
                throw new IOException("Encountered corrupt PNG file.");
            }
        }
    }

    public final void m616(C0289 c0289) {
        boolean z;
        C0287 c0287;
        int m634;
        HashMap<String, C0287> hashMap = this.f1413[4];
        C0287 c02872 = hashMap.get("Compression");
        if (c02872 != null) {
            int m6342 = c02872.m634(this.f1423);
            this.f1418 = m6342;
            if (m6342 != 1) {
                if (m6342 == 6) {
                    m610(c0289, hashMap);
                    return;
                } else if (m6342 != 7) {
                    return;
                }
            }
            C0287 c02873 = hashMap.get("BitsPerSample");
            if (c02873 != null) {
                int[] iArr = (int[]) c02873.m633(this.f1423);
                int[] iArr2 = f1400;
                if (Arrays.equals(iArr2, iArr) || (this.f1410 == 3 && (c0287 = hashMap.get("PhotometricInterpretation")) != null && (((m634 = c0287.m634(this.f1423)) == 1 && Arrays.equals(iArr, f1395)) || (m634 == 6 && Arrays.equals(iArr, iArr2))))) {
                    z = true;
                    if (z) {
                        return;
                    }
                    C0287 c02874 = hashMap.get("StripOffsets");
                    C0287 c02875 = hashMap.get("StripByteCounts");
                    if (c02874 == null || c02875 == null) {
                        return;
                    }
                    long[] m601 = m601(c02874.m633(this.f1423));
                    long[] m6012 = m601(c02875.m633(this.f1423));
                    if (m601 != null && m601.length != 0) {
                        if (m6012 != null && m6012.length != 0) {
                            if (m601.length != m6012.length) {
                                Log.w("ExifInterface", "stripOffsets and stripByteCounts should have same length.");
                                return;
                            }
                            long j = 0;
                            for (long j2 : m6012) {
                                j += j2;
                            }
                            int i = (int) j;
                            byte[] bArr = new byte[i];
                            this.f1421 = true;
                            int i2 = 0;
                            int i3 = 0;
                            for (int i4 = 0; i4 < m601.length; i4++) {
                                int i5 = (int) m601[i4];
                                int i6 = (int) m6012[i4];
                                if (i4 < m601.length - 1 && i5 + i6 != m601[i4 + 1]) {
                                    this.f1421 = false;
                                }
                                int i7 = i5 - i2;
                                if (i7 < 0) {
                                    Log.d("ExifInterface", "Invalid strip offset value");
                                }
                                c0289.m637(i7);
                                int i8 = i2 + i7;
                                byte[] bArr2 = new byte[i6];
                                c0289.read(bArr2);
                                i2 = i8 + i6;
                                System.arraycopy(bArr2, 0, bArr, i3, i6);
                                i3 += i6;
                            }
                            if (this.f1421) {
                                this.f1411 = ((int) m601[0]) + this.f1420;
                                this.f1416 = i;
                                return;
                            }
                            return;
                        }
                        Log.w("ExifInterface", "stripByteCounts should not be null or have zero length.");
                        return;
                    }
                    Log.w("ExifInterface", "stripOffsets should not be null or have zero length.");
                    return;
                }
            }
            if (f1397) {
                Log.d("ExifInterface", "Unsupported data type value");
            }
            z = false;
            if (z) {
            }
        } else {
            this.f1418 = 6;
            m610(c0289, hashMap);
        }
    }

    public final void m617(C0289 c0289) {
        c0289.skipBytes(84);
        byte[] bArr = new byte[4];
        byte[] bArr2 = new byte[4];
        c0289.read(bArr);
        c0289.skipBytes(4);
        c0289.read(bArr2);
        int i = ByteBuffer.wrap(bArr).getInt();
        int i2 = ByteBuffer.wrap(bArr2).getInt();
        m627(c0289, i, 5);
        c0289.m637(i2);
        c0289.f1436 = ByteOrder.BIG_ENDIAN;
        int readInt = c0289.readInt();
        if (f1397) {
            Log.d("ExifInterface", "numberOfDirectoryEntry: " + readInt);
        }
        for (int i3 = 0; i3 < readInt; i3++) {
            int readUnsignedShort = c0289.readUnsignedShort();
            int readUnsignedShort2 = c0289.readUnsignedShort();
            if (readUnsignedShort == f1405.f1437) {
                short readShort = c0289.readShort();
                short readShort2 = c0289.readShort();
                C0287 m631 = C0287.m631(readShort, this.f1423);
                C0287 m6312 = C0287.m631(readShort2, this.f1423);
                this.f1413[0].put("ImageLength", m631);
                this.f1413[0].put("ImageWidth", m6312);
                if (f1397) {
                    Log.d("ExifInterface", "Updated to length: " + ((int) readShort) + ", width: " + ((int) readShort2));
                    return;
                }
                return;
            }
            c0289.skipBytes(readUnsignedShort2);
        }
    }

    public String m618(String str) {
        C0287 m609 = m609(str);
        if (m609 != null) {
            if (!f1372.contains(str)) {
                return m609.m635(this.f1423);
            }
            if (str.equals("GPSTimeStamp")) {
                int i = m609.f1426;
                if (i != 5 && i != 10) {
                    StringBuilder m8071 = C9125.m8071("GPS Timestamp format is not rational. format=");
                    m8071.append(m609.f1426);
                    Log.w("ExifInterface", m8071.toString());
                    return null;
                }
                C0288[] c0288Arr = (C0288[]) m609.m633(this.f1423);
                if (c0288Arr != null && c0288Arr.length == 3) {
                    return String.format("%02d:%02d:%02d", Integer.valueOf((int) (((float) c0288Arr[0].f1429) / ((float) c0288Arr[0].f1430))), Integer.valueOf((int) (((float) c0288Arr[1].f1429) / ((float) c0288Arr[1].f1430))), Integer.valueOf((int) (((float) c0288Arr[2].f1429) / ((float) c0288Arr[2].f1430))));
                }
                StringBuilder m80712 = C9125.m8071("Invalid GPS Timestamp array. array=");
                m80712.append(Arrays.toString(c0288Arr));
                Log.w("ExifInterface", m80712.toString());
                return null;
            }
            try {
                return Double.toString(m609.m632(this.f1423));
            } catch (NumberFormatException unused) {
            }
        }
        return null;
    }

    public final void m619() {
        for (int i = 0; i < this.f1413.length; i++) {
            StringBuilder m8133 = C9125.m8133("The size of tag group[", i, "]: ");
            m8133.append(this.f1413[i].size());
            Log.d("ExifInterface", m8133.toString());
            for (Map.Entry<String, C0287> entry : this.f1413[i].entrySet()) {
                C0287 value = entry.getValue();
                StringBuilder m8071 = C9125.m8071("tagName: ");
                m8071.append(entry.getKey());
                m8071.append(", tagType: ");
                m8071.append(value.toString());
                m8071.append(", tagValue: '");
                m8071.append(value.m635(this.f1423));
                m8071.append("'");
                Log.d("ExifInterface", m8071.toString());
            }
        }
    }

    public final void m620(C0289 c0289) {
        C0287 c0287;
        m625(c0289, c0289.available());
        m626(c0289, 0);
        m606(c0289, 0);
        m606(c0289, 5);
        m606(c0289, 4);
        m623();
        if (this.f1410 != 8 || (c0287 = this.f1413[1].get("MakerNote")) == null) {
            return;
        }
        C0289 c02892 = new C0289(c0287.f1427);
        c02892.f1436 = this.f1423;
        c02892.m637(6L);
        m626(c02892, 9);
        C0287 c02872 = this.f1413[9].get("ColorSpace");
        if (c02872 != null) {
            this.f1413[1].put("ColorSpace", c02872);
        }
    }

    public final boolean m621(HashMap hashMap) {
        C0287 c0287 = (C0287) hashMap.get("ImageLength");
        C0287 c02872 = (C0287) hashMap.get("ImageWidth");
        if (c0287 == null || c02872 == null) {
            return false;
        }
        return c0287.m634(this.f1423) <= 512 && c02872.m634(this.f1423) <= 512;
    }

    public final int m622(BufferedInputStream bufferedInputStream) {
        boolean z;
        boolean z2;
        C0289 c0289;
        C0289 c02892;
        boolean z3;
        C0289 c02893;
        C0289 c02894;
        boolean z4;
        C0289 c02895;
        C0289 c02896;
        boolean z5;
        boolean z6;
        boolean z7;
        bufferedInputStream.mark(5000);
        byte[] bArr = new byte[5000];
        bufferedInputStream.read(bArr);
        bufferedInputStream.reset();
        int i = 0;
        while (true) {
            byte[] bArr2 = f1390;
            if (i >= bArr2.length) {
                z = true;
                break;
            } else if (bArr[i] != bArr2[i]) {
                z = false;
                break;
            } else {
                i++;
            }
        }
        if (z) {
            return 4;
        }
        byte[] bytes = "FUJIFILMCCD-RAW".getBytes(Charset.defaultCharset());
        int i2 = 0;
        while (true) {
            if (i2 >= bytes.length) {
                z2 = true;
                break;
            } else if (bArr[i2] != bytes[i2]) {
                z2 = false;
                break;
            } else {
                i2++;
            }
        }
        if (z2) {
            return 9;
        }
        try {
            c02892 = new C0289(bArr);
            try {
                long readInt = c02892.readInt();
                byte[] bArr3 = new byte[4];
                c02892.read(bArr3);
                if (Arrays.equals(bArr3, f1389)) {
                    long j = 16;
                    if (readInt == 1) {
                        readInt = c02892.readLong();
                        if (readInt < 16) {
                        }
                    } else {
                        j = 8;
                    }
                    long j2 = 5000;
                    if (readInt > j2) {
                        readInt = j2;
                    }
                    long j3 = readInt - j;
                    if (j3 >= 8) {
                        byte[] bArr4 = new byte[4];
                        boolean z8 = false;
                        boolean z9 = false;
                        for (long j4 = 0; j4 < j3 / 4 && c02892.read(bArr4) == 4; j4++) {
                            if (j4 != 1) {
                                if (Arrays.equals(bArr4, f1401)) {
                                    z8 = true;
                                } else if (Arrays.equals(bArr4, f1391)) {
                                    z9 = true;
                                }
                                if (z8 && z9) {
                                    c02892.close();
                                    z3 = true;
                                    break;
                                }
                            }
                        }
                    }
                }
            } catch (Exception e) {
                e = e;
                try {
                    if (f1397) {
                        Log.d("ExifInterface", "Exception parsing HEIF file type box.", e);
                    }
                } catch (Throwable th) {
                    th = th;
                    c0289 = c02892;
                    c02892 = c0289;
                    if (c02892 != null) {
                        c02892.close();
                    }
                    throw th;
                }
            } catch (Throwable th2) {
                th = th2;
                if (c02892 != null) {
                }
                throw th;
            }
        } catch (Exception e2) {
            e = e2;
            c02892 = null;
        } catch (Throwable th3) {
            th = th3;
            c0289 = null;
            c02892 = c0289;
            if (c02892 != null) {
            }
            throw th;
        }
        c02892.close();
        z3 = false;
        if (z3) {
            return 12;
        }
        try {
            c02894 = new C0289(bArr);
            try {
                ByteOrder m614 = m614(c02894);
                this.f1423 = m614;
                c02894.f1436 = m614;
                short readShort = c02894.readShort();
                z4 = readShort == 20306 || readShort == 21330;
                c02894.close();
            } catch (Exception unused) {
                if (c02894 != null) {
                    c02894.close();
                }
                z4 = false;
                if (z4) {
                }
            } catch (Throwable th4) {
                th = th4;
                c02893 = c02894;
                if (c02893 != null) {
                    c02893.close();
                }
                throw th;
            }
        } catch (Exception unused2) {
            c02894 = null;
        } catch (Throwable th5) {
            th = th5;
            c02893 = null;
        }
        if (z4) {
            try {
                C0289 c02897 = new C0289(bArr);
                try {
                    ByteOrder m6142 = m614(c02897);
                    this.f1423 = m6142;
                    c02897.f1436 = m6142;
                    z5 = c02897.readShort() == 85;
                    c02897.close();
                } catch (Exception unused3) {
                    c02896 = c02897;
                    if (c02896 != null) {
                        c02896.close();
                    }
                    z5 = false;
                    if (z5) {
                    }
                } catch (Throwable th6) {
                    th = th6;
                    c02895 = c02897;
                    if (c02895 != null) {
                        c02895.close();
                    }
                    throw th;
                }
            } catch (Exception unused4) {
                c02896 = null;
            } catch (Throwable th7) {
                th = th7;
                c02895 = null;
            }
            if (z5) {
                int i3 = 0;
                while (true) {
                    byte[] bArr5 = f1373;
                    if (i3 >= bArr5.length) {
                        z6 = true;
                        break;
                    } else if (bArr[i3] != bArr5[i3]) {
                        z6 = false;
                        break;
                    } else {
                        i3++;
                    }
                }
                if (z6) {
                    return 13;
                }
                int i4 = 0;
                while (true) {
                    byte[] bArr6 = f1385;
                    if (i4 >= bArr6.length) {
                        int i5 = 0;
                        while (true) {
                            byte[] bArr7 = f1406;
                            if (i5 >= bArr7.length) {
                                z7 = true;
                                break;
                            } else if (bArr[f1385.length + i5 + 4] != bArr7[i5]) {
                                break;
                            } else {
                                i5++;
                            }
                        }
                    } else if (bArr[i4] != bArr6[i4]) {
                        break;
                    } else {
                        i4++;
                    }
                }
                z7 = false;
                return z7 ? 14 : 0;
            }
            return 10;
        }
        return 7;
    }

    public final void m623() {
        m612(0, 5);
        m612(0, 4);
        m612(5, 4);
        C0287 c0287 = this.f1413[1].get("PixelXDimension");
        C0287 c02872 = this.f1413[1].get("PixelYDimension");
        if (c0287 != null && c02872 != null) {
            this.f1413[0].put("ImageWidth", c0287);
            this.f1413[0].put("ImageLength", c02872);
        }
        if (this.f1413[4].isEmpty() && m621(this.f1413[5])) {
            HashMap<String, C0287>[] hashMapArr = this.f1413;
            hashMapArr[4] = hashMapArr[5];
            hashMapArr[5] = new HashMap<>();
        }
        if (m621(this.f1413[4])) {
            return;
        }
        Log.d("ExifInterface", "No image meets the size requirements of a thumbnail image.");
    }

    public final void m624(C0289 c0289) {
        String str;
        String str2;
        MediaMetadataRetriever mediaMetadataRetriever = new MediaMetadataRetriever();
        try {
            mediaMetadataRetriever.setDataSource(new C0286(this, c0289));
            String extractMetadata = mediaMetadataRetriever.extractMetadata(33);
            String extractMetadata2 = mediaMetadataRetriever.extractMetadata(34);
            String extractMetadata3 = mediaMetadataRetriever.extractMetadata(26);
            String extractMetadata4 = mediaMetadataRetriever.extractMetadata(17);
            String str3 = null;
            if ("yes".equals(extractMetadata3)) {
                str3 = mediaMetadataRetriever.extractMetadata(29);
                str = mediaMetadataRetriever.extractMetadata(30);
                str2 = mediaMetadataRetriever.extractMetadata(31);
            } else if ("yes".equals(extractMetadata4)) {
                str3 = mediaMetadataRetriever.extractMetadata(18);
                str = mediaMetadataRetriever.extractMetadata(19);
                str2 = mediaMetadataRetriever.extractMetadata(24);
            } else {
                str = null;
                str2 = null;
            }
            if (str3 != null) {
                this.f1413[0].put("ImageWidth", C0287.m631(Integer.parseInt(str3), this.f1423));
            }
            if (str != null) {
                this.f1413[0].put("ImageLength", C0287.m631(Integer.parseInt(str), this.f1423));
            }
            if (str2 != null) {
                int i = 1;
                int parseInt = Integer.parseInt(str2);
                if (parseInt == 90) {
                    i = 6;
                } else if (parseInt == 180) {
                    i = 3;
                } else if (parseInt == 270) {
                    i = 8;
                }
                this.f1413[0].put("Orientation", C0287.m631(i, this.f1423));
            }
            if (extractMetadata != null && extractMetadata2 != null) {
                int parseInt2 = Integer.parseInt(extractMetadata);
                int parseInt3 = Integer.parseInt(extractMetadata2);
                if (parseInt3 > 6) {
                    c0289.m637(parseInt2);
                    byte[] bArr = new byte[6];
                    if (c0289.read(bArr) == 6) {
                        int i2 = parseInt2 + 6;
                        int i3 = parseInt3 - 6;
                        if (Arrays.equals(bArr, f1403)) {
                            byte[] bArr2 = new byte[i3];
                            if (c0289.read(bArr2) == i3) {
                                this.f1420 = i2;
                                m613(bArr2, 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");
                }
            }
            if (f1397) {
                Log.d("ExifInterface", "Heif meta: " + str3 + "x" + str + ", rotation " + str2);
            }
        } finally {
            mediaMetadataRetriever.release();
        }
    }

    public final void m625(C0289 c0289, int i) {
        ByteOrder m614 = m614(c0289);
        this.f1423 = m614;
        c0289.f1436 = m614;
        int readUnsignedShort = c0289.readUnsignedShort();
        int i2 = this.f1410;
        if (i2 != 7 && i2 != 10 && readUnsignedShort != 42) {
            StringBuilder m8071 = C9125.m8071("Invalid start code: ");
            m8071.append(Integer.toHexString(readUnsignedShort));
            throw new IOException(m8071.toString());
        }
        int readInt = c0289.readInt();
        if (readInt >= 8 && readInt < i) {
            int i3 = readInt - 8;
            if (i3 > 0 && c0289.skipBytes(i3) != i3) {
                throw new IOException(C9125.m8086("Couldn't jump to first Ifd: ", i3));
            }
            return;
        }
        throw new IOException(C9125.m8086("Invalid first Ifd offset: ", readInt));
    }

    public final void m626(C0289 c0289, int i) {
        short s;
        short s2;
        int[] iArr;
        boolean z;
        long j;
        boolean z2;
        int i2;
        int i3;
        int i4;
        C0290 c0290;
        String str;
        int readUnsignedShort;
        long j2;
        int i5;
        int i6 = i;
        this.f1422.add(Integer.valueOf(c0289.f1433));
        if (c0289.f1433 + 2 > c0289.f1434) {
            return;
        }
        short readShort = c0289.readShort();
        String str2 = "ExifInterface";
        if (f1397) {
            Log.d("ExifInterface", "numberOfDirectoryEntry: " + ((int) readShort));
        }
        if ((readShort * 12) + c0289.f1433 > c0289.f1434 || readShort <= 0) {
            return;
        }
        short s3 = 0;
        char c = 0;
        while (s3 < readShort) {
            int readUnsignedShort2 = c0289.readUnsignedShort();
            int readUnsignedShort3 = c0289.readUnsignedShort();
            int readInt = c0289.readInt();
            long j3 = c0289.f1433 + 4;
            C0290 c02902 = f1384[i6].get(Integer.valueOf(readUnsignedShort2));
            boolean z3 = f1397;
            if (z3) {
                Object[] objArr = new Object[5];
                objArr[c] = Integer.valueOf(i);
                objArr[1] = Integer.valueOf(readUnsignedShort2);
                objArr[2] = c02902 != null ? c02902.f1439 : null;
                objArr[3] = Integer.valueOf(readUnsignedShort3);
                objArr[4] = Integer.valueOf(readInt);
                Log.d(str2, String.format("ifdType: %d, tagNumber: %d, tagName: %s, dataFormat: %d, numberOfComponents: %d", objArr));
            }
            if (c02902 == null) {
                if (z3) {
                    Log.d(str2, "Skip the tag entry since tag number is not defined: " + readUnsignedShort2);
                }
                s = readShort;
            } else {
                if (readUnsignedShort3 > 0) {
                    if (readUnsignedShort3 < f1381.length) {
                        int i7 = c02902.f1438;
                        if (i7 == 7 || readUnsignedShort3 == 7 || i7 == readUnsignedShort3 || (i2 = c02902.f1440) == readUnsignedShort3) {
                            s = readShort;
                        } else {
                            s = readShort;
                            if (((i7 != 4 && i2 != 4) || readUnsignedShort3 != 3) && (((i7 != 9 && i2 != 9) || readUnsignedShort3 != 8) && ((i7 != 12 && i2 != 12) || readUnsignedShort3 != 11))) {
                                z = false;
                                if (!z) {
                                    short s4 = s3;
                                    if (readUnsignedShort3 == 7) {
                                        readUnsignedShort3 = i7;
                                    }
                                    s2 = s4;
                                    j = readInt * iArr[readUnsignedShort3];
                                    if (j < 0 || j > 2147483647L) {
                                        if (z3) {
                                            Log.d(str2, "Skip the tag entry since the number of components is invalid: " + readInt);
                                        }
                                        z2 = false;
                                    } else {
                                        z2 = true;
                                    }
                                    if (!z2) {
                                        c0289.m637(j3);
                                    } else {
                                        if (j > 4) {
                                            int readInt2 = c0289.readInt();
                                            if (z3) {
                                                StringBuilder sb = new StringBuilder();
                                                i3 = readUnsignedShort3;
                                                sb.append("seek to data offset: ");
                                                sb.append(readInt2);
                                                Log.d(str2, sb.toString());
                                            } else {
                                                i3 = readUnsignedShort3;
                                            }
                                            int i8 = this.f1410;
                                            if (i8 == 7) {
                                                if ("MakerNote".equals(c02902.f1439)) {
                                                    this.f1408 = readInt2;
                                                } else if (i6 == 6 && "ThumbnailImage".equals(c02902.f1439)) {
                                                    this.f1415 = readInt2;
                                                    this.f1412 = readInt;
                                                    C0287 m631 = C0287.m631(6, this.f1423);
                                                    j2 = j3;
                                                    C0287 m630 = C0287.m630(this.f1415, this.f1423);
                                                    i5 = readInt;
                                                    C0287 m6302 = C0287.m630(this.f1412, this.f1423);
                                                    this.f1413[4].put("Compression", m631);
                                                    this.f1413[4].put("JPEGInterchangeFormat", m630);
                                                    this.f1413[4].put("JPEGInterchangeFormatLength", m6302);
                                                }
                                                j2 = j3;
                                                i5 = readInt;
                                            } else {
                                                j2 = j3;
                                                i5 = readInt;
                                                if (i8 == 10 && "JpgFromRaw".equals(c02902.f1439)) {
                                                    this.f1414 = readInt2;
                                                }
                                            }
                                            long j4 = readInt2;
                                            i4 = i5;
                                            c0290 = c02902;
                                            if (j4 + j <= c0289.f1434) {
                                                c0289.m637(j4);
                                                j3 = j2;
                                            } else {
                                                if (z3) {
                                                    Log.d(str2, "Skip the tag entry since data offset is invalid: " + readInt2);
                                                }
                                                c0289.m637(j2);
                                            }
                                        } else {
                                            i3 = readUnsignedShort3;
                                            i4 = readInt;
                                            c0290 = c02902;
                                        }
                                        Integer num = f1378.get(Integer.valueOf(readUnsignedShort2));
                                        if (z3) {
                                            Log.d(str2, "nextIfdType: " + num + " byteCount: " + j);
                                        }
                                        if (num != null) {
                                            long j5 = -1;
                                            int i9 = i3;
                                            if (i9 == 3) {
                                                readUnsignedShort = c0289.readUnsignedShort();
                                            } else {
                                                if (i9 == 4) {
                                                    j5 = c0289.m636();
                                                } else if (i9 == 8) {
                                                    readUnsignedShort = c0289.readShort();
                                                } else if (i9 == 9 || i9 == 13) {
                                                    readUnsignedShort = c0289.readInt();
                                                }
                                                if (z3) {
                                                    Log.d(str2, String.format("Offset: %d, tagName: %s", Long.valueOf(j5), c0290.f1439));
                                                }
                                                if (j5 > 0 || j5 >= c0289.f1434) {
                                                    if (z3) {
                                                        Log.d(str2, "Skip jump into the IFD since its offset is invalid: " + j5);
                                                    }
                                                } else if (!this.f1422.contains(Integer.valueOf((int) j5))) {
                                                    c0289.m637(j5);
                                                    m626(c0289, num.intValue());
                                                } else if (z3) {
                                                    Log.d(str2, "Skip jump into the IFD since it has already been read: IfdType " + num + " (at " + j5 + ")");
                                                }
                                                c0289.m637(j3);
                                            }
                                            j5 = readUnsignedShort;
                                            if (z3) {
                                            }
                                            if (j5 > 0) {
                                            }
                                            if (z3) {
                                            }
                                            c0289.m637(j3);
                                        } else {
                                            C0290 c02903 = c0290;
                                            byte[] bArr = new byte[(int) j];
                                            c0289.readFully(bArr);
                                            long j6 = j3;
                                            str = str2;
                                            C0287 c0287 = new C0287(i3, i4, c0289.f1433 + this.f1420, bArr);
                                            this.f1413[i].put(c02903.f1439, c0287);
                                            if ("DNGVersion".equals(c02903.f1439)) {
                                                this.f1410 = 3;
                                            }
                                            if ((("Make".equals(c02903.f1439) || "Model".equals(c02903.f1439)) && c0287.m635(this.f1423).contains("PENTAX")) || ("Compression".equals(c02903.f1439) && c0287.m634(this.f1423) == 65535)) {
                                                this.f1410 = 8;
                                            }
                                            if (c0289.f1433 != j6) {
                                                c0289.m637(j6);
                                            }
                                            s3 = (short) (s2 + 1);
                                            c = 0;
                                            str2 = str;
                                            readShort = s;
                                            i6 = i;
                                        }
                                    }
                                    str = str2;
                                    s3 = (short) (s2 + 1);
                                    c = 0;
                                    str2 = str;
                                    readShort = s;
                                    i6 = i;
                                } else if (z3) {
                                    StringBuilder m8071 = C9125.m8071("Skip the tag entry since data format (");
                                    m8071.append(f1392[readUnsignedShort3]);
                                    m8071.append(") is unexpected for tag: ");
                                    m8071.append(c02902.f1439);
                                    Log.d(str2, m8071.toString());
                                }
                            }
                        }
                        z = true;
                        if (!z) {
                        }
                    }
                }
                s = readShort;
                s2 = s3;
                if (z3) {
                    Log.d(str2, "Skip the tag entry since data format is invalid: " + readUnsignedShort3);
                }
                z2 = false;
                j = 0;
                if (!z2) {
                }
                str = str2;
                s3 = (short) (s2 + 1);
                c = 0;
                str2 = str;
                readShort = s;
                i6 = i;
            }
            s2 = s3;
            z2 = false;
            j = 0;
            if (!z2) {
            }
            str = str2;
            s3 = (short) (s2 + 1);
            c = 0;
            str2 = str;
            readShort = s;
            i6 = i;
        }
        String str3 = str2;
        if (c0289.f1433 + 4 <= c0289.f1434) {
            int readInt3 = c0289.readInt();
            boolean z4 = f1397;
            if (z4) {
                Log.d(str3, String.format("nextIfdOffset: %d", Integer.valueOf(readInt3)));
            }
            long j7 = readInt3;
            if (j7 <= 0 || readInt3 >= c0289.f1434) {
                if (z4) {
                    Log.d(str3, "Stop reading file since a wrong offset may cause an infinite loop: " + readInt3);
                }
            } else if (this.f1422.contains(Integer.valueOf(readInt3))) {
                if (z4) {
                    Log.d(str3, "Stop reading file since re-reading an IFD may cause an infinite loop: " + readInt3);
                }
            } else {
                c0289.m637(j7);
                if (this.f1413[4].isEmpty()) {
                    m626(c0289, 4);
                } else if (this.f1413[5].isEmpty()) {
                    m626(c0289, 5);
                }
            }
        }
    }

    public final void m627(C0289 c0289, int i, int i2) {
        if (f1397) {
            Log.d("ExifInterface", "getJpegAttributes starting with: " + c0289);
        }
        c0289.f1436 = ByteOrder.BIG_ENDIAN;
        c0289.m637(i);
        byte readByte = c0289.readByte();
        byte b = -1;
        if (readByte == -1) {
            int i3 = 1;
            int i4 = i + 1;
            if (c0289.readByte() != -40) {
                StringBuilder m8071 = C9125.m8071("Invalid marker: ");
                m8071.append(Integer.toHexString(readByte & 255));
                throw new IOException(m8071.toString());
            }
            int i5 = i4 + 1;
            while (true) {
                byte readByte2 = c0289.readByte();
                if (readByte2 == b) {
                    int i6 = i5 + i3;
                    byte readByte3 = c0289.readByte();
                    boolean z = f1397;
                    if (z) {
                        StringBuilder m80712 = C9125.m8071("Found JPEG segment indicator: ");
                        m80712.append(Integer.toHexString(readByte3 & 255));
                        Log.d("ExifInterface", m80712.toString());
                    }
                    int i7 = i6 + i3;
                    if (readByte3 != -39 && readByte3 != -38) {
                        int readUnsignedShort = c0289.readUnsignedShort() - 2;
                        int i8 = i7 + 2;
                        if (z) {
                            StringBuilder m80713 = C9125.m8071("JPEG segment: ");
                            m80713.append(Integer.toHexString(readByte3 & 255));
                            m80713.append(" (length: ");
                            m80713.append(readUnsignedShort + 2);
                            m80713.append(")");
                            Log.d("ExifInterface", m80713.toString());
                        }
                        if (readUnsignedShort < 0) {
                            throw new IOException("Invalid length");
                        }
                        if (readByte3 == -31) {
                            byte[] bArr = new byte[readUnsignedShort];
                            c0289.readFully(bArr);
                            int i9 = i8 + readUnsignedShort;
                            byte[] bArr2 = f1403;
                            if (m603(bArr, bArr2)) {
                                byte[] copyOfRange = Arrays.copyOfRange(bArr, bArr2.length, readUnsignedShort);
                                this.f1420 = i8 + bArr2.length;
                                m613(copyOfRange, i2);
                            } else {
                                byte[] bArr3 = f1386;
                                if (m603(bArr, bArr3)) {
                                    int length = i8 + bArr3.length;
                                    byte[] copyOfRange2 = Arrays.copyOfRange(bArr, bArr3.length, readUnsignedShort);
                                    if (m618("Xmp") == null) {
                                        this.f1413[0].put("Xmp", new C0287(1, copyOfRange2.length, length, copyOfRange2));
                                    }
                                }
                            }
                            readUnsignedShort = 0;
                            i8 = i9;
                        } else if (readByte3 != -2) {
                            switch (readByte3) {
                                default:
                                    switch (readByte3) {
                                        default:
                                            switch (readByte3) {
                                                default:
                                                    switch (readByte3) {
                                                    }
                                                case -55:
                                                case -54:
                                                case -53:
                                                    if (c0289.skipBytes(i3) == i3) {
                                                        this.f1413[i2].put("ImageLength", C0287.m630(c0289.readUnsignedShort(), this.f1423));
                                                        this.f1413[i2].put("ImageWidth", C0287.m630(c0289.readUnsignedShort(), this.f1423));
                                                        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;
                            }
                        } else {
                            byte[] bArr4 = new byte[readUnsignedShort];
                            if (c0289.read(bArr4) == readUnsignedShort) {
                                if (m618("UserComment") == null) {
                                    this.f1413[i3].put("UserComment", C0287.m628(new String(bArr4, f1407)));
                                }
                                readUnsignedShort = 0;
                            } else {
                                throw new IOException("Invalid exif");
                            }
                        }
                        if (readUnsignedShort >= 0) {
                            if (c0289.skipBytes(readUnsignedShort) != readUnsignedShort) {
                                throw new IOException("Invalid JPEG segment");
                            }
                            i5 = i8 + readUnsignedShort;
                            b = -1;
                            i3 = 1;
                        } else {
                            throw new IOException("Invalid length");
                        }
                    }
                } else {
                    StringBuilder m80714 = C9125.m8071("Invalid marker:");
                    m80714.append(Integer.toHexString(readByte2 & 255));
                    throw new IOException(m80714.toString());
                }
            }
        } else {
            StringBuilder m80715 = C9125.m8071("Invalid marker: ");
            m80715.append(Integer.toHexString(readByte & 255));
            throw new IOException(m80715.toString());
        }
    }

    public static class C0289 extends InputStream implements DataInput {
        public static final ByteOrder f1431 = ByteOrder.LITTLE_ENDIAN;
        public static final ByteOrder f1432 = ByteOrder.BIG_ENDIAN;
        public int f1433;
        public final int f1434;
        public DataInputStream f1435;
        public ByteOrder f1436;

        public C0289(InputStream inputStream) {
            ByteOrder byteOrder = ByteOrder.BIG_ENDIAN;
            this.f1436 = byteOrder;
            DataInputStream dataInputStream = new DataInputStream(inputStream);
            this.f1435 = dataInputStream;
            int available = dataInputStream.available();
            this.f1434 = available;
            this.f1433 = 0;
            this.f1435.mark(available);
            this.f1436 = byteOrder;
        }

        @Override
        public int available() {
            return this.f1435.available();
        }

        @Override
        public int read() {
            this.f1433++;
            return this.f1435.read();
        }

        @Override
        public boolean readBoolean() {
            this.f1433++;
            return this.f1435.readBoolean();
        }

        @Override
        public byte readByte() {
            int i = this.f1433 + 1;
            this.f1433 = i;
            if (i <= this.f1434) {
                int read = this.f1435.read();
                if (read >= 0) {
                    return (byte) read;
                }
                throw new EOFException();
            }
            throw new EOFException();
        }

        @Override
        public char readChar() {
            this.f1433 += 2;
            return this.f1435.readChar();
        }

        @Override
        public double readDouble() {
            return Double.longBitsToDouble(readLong());
        }

        @Override
        public float readFloat() {
            return Float.intBitsToFloat(readInt());
        }

        @Override
        public void readFully(byte[] bArr, int i, int i2) {
            int i3 = this.f1433 + i2;
            this.f1433 = i3;
            if (i3 <= this.f1434) {
                if (this.f1435.read(bArr, i, i2) != i2) {
                    throw new IOException("Couldn't read up to the length of buffer");
                }
                return;
            }
            throw new EOFException();
        }

        @Override
        public int readInt() {
            int i = this.f1433 + 4;
            this.f1433 = i;
            if (i <= this.f1434) {
                int read = this.f1435.read();
                int read2 = this.f1435.read();
                int read3 = this.f1435.read();
                int read4 = this.f1435.read();
                if ((read | read2 | read3 | read4) >= 0) {
                    ByteOrder byteOrder = this.f1436;
                    if (byteOrder == f1431) {
                        return (read4 << 24) + (read3 << 16) + (read2 << 8) + read;
                    }
                    if (byteOrder == f1432) {
                        return (read << 24) + (read2 << 16) + (read3 << 8) + read4;
                    }
                    StringBuilder m8071 = C9125.m8071("Invalid byte order: ");
                    m8071.append(this.f1436);
                    throw new IOException(m8071.toString());
                }
                throw new EOFException();
            }
            throw new EOFException();
        }

        @Override
        public String readLine() {
            Log.d("ExifInterface", "Currently unsupported");
            return null;
        }

        @Override
        public long readLong() {
            int i = this.f1433 + 8;
            this.f1433 = i;
            if (i <= this.f1434) {
                int read = this.f1435.read();
                int read2 = this.f1435.read();
                int read3 = this.f1435.read();
                int read4 = this.f1435.read();
                int read5 = this.f1435.read();
                int read6 = this.f1435.read();
                int read7 = this.f1435.read();
                int read8 = this.f1435.read();
                if ((read | read2 | read3 | read4 | read5 | read6 | read7 | read8) >= 0) {
                    ByteOrder byteOrder = this.f1436;
                    if (byteOrder == f1431) {
                        return (read8 << 56) + (read7 << 48) + (read6 << 40) + (read5 << 32) + (read4 << 24) + (read3 << 16) + (read2 << 8) + read;
                    }
                    if (byteOrder == f1432) {
                        return (read << 56) + (read2 << 48) + (read3 << 40) + (read4 << 32) + (read5 << 24) + (read6 << 16) + (read7 << 8) + read8;
                    }
                    StringBuilder m8071 = C9125.m8071("Invalid byte order: ");
                    m8071.append(this.f1436);
                    throw new IOException(m8071.toString());
                }
                throw new EOFException();
            }
            throw new EOFException();
        }

        @Override
        public short readShort() {
            int i = this.f1433 + 2;
            this.f1433 = i;
            if (i <= this.f1434) {
                int read = this.f1435.read();
                int read2 = this.f1435.read();
                if ((read | read2) >= 0) {
                    ByteOrder byteOrder = this.f1436;
                    if (byteOrder == f1431) {
                        return (short) ((read2 << 8) + read);
                    }
                    if (byteOrder == f1432) {
                        return (short) ((read << 8) + read2);
                    }
                    StringBuilder m8071 = C9125.m8071("Invalid byte order: ");
                    m8071.append(this.f1436);
                    throw new IOException(m8071.toString());
                }
                throw new EOFException();
            }
            throw new EOFException();
        }

        @Override
        public String readUTF() {
            this.f1433 += 2;
            return this.f1435.readUTF();
        }

        @Override
        public int readUnsignedByte() {
            this.f1433++;
            return this.f1435.readUnsignedByte();
        }

        @Override
        public int readUnsignedShort() {
            int i = this.f1433 + 2;
            this.f1433 = i;
            if (i <= this.f1434) {
                int read = this.f1435.read();
                int read2 = this.f1435.read();
                if ((read | read2) >= 0) {
                    ByteOrder byteOrder = this.f1436;
                    if (byteOrder == f1431) {
                        return (read2 << 8) + read;
                    }
                    if (byteOrder == f1432) {
                        return (read << 8) + read2;
                    }
                    StringBuilder m8071 = C9125.m8071("Invalid byte order: ");
                    m8071.append(this.f1436);
                    throw new IOException(m8071.toString());
                }
                throw new EOFException();
            }
            throw new EOFException();
        }

        @Override
        public int skipBytes(int i) {
            int min = Math.min(i, this.f1434 - this.f1433);
            int i2 = 0;
            while (i2 < min) {
                i2 += this.f1435.skipBytes(min - i2);
            }
            this.f1433 += i2;
            return i2;
        }

        public long m636() {
            return readInt() & 4294967295L;
        }

        public void m637(long j) {
            int i = this.f1433;
            if (i > j) {
                this.f1433 = 0;
                this.f1435.reset();
                this.f1435.mark(this.f1434);
            } else {
                j -= i;
            }
            int i2 = (int) j;
            if (skipBytes(i2) != i2) {
                throw new IOException("Couldn't seek up to the byteCount");
            }
        }

        @Override
        public int read(byte[] bArr, int i, int i2) {
            int read = this.f1435.read(bArr, i, i2);
            this.f1433 += read;
            return read;
        }

        @Override
        public void readFully(byte[] bArr) {
            int length = this.f1433 + bArr.length;
            this.f1433 = length;
            if (length <= this.f1434) {
                if (this.f1435.read(bArr, 0, bArr.length) != bArr.length) {
                    throw new IOException("Couldn't read up to the length of buffer");
                }
                return;
            }
            throw new EOFException();
        }

        public C0289(byte[] bArr) {
            this(new ByteArrayInputStream(bArr));
        }
    }

    public static class C0287 {
        public final int f1426;
        public final byte[] f1427;
        public final int f1428;

        public C0287(int i, int i2, long j, byte[] bArr) {
            this.f1426 = i;
            this.f1428 = i2;
            this.f1427 = bArr;
        }

        public static C0287 m628(String str) {
            byte[] bytes = (str + (char) 0).getBytes(C0285.f1407);
            return new C0287(2, bytes.length, bytes);
        }

        public static C0287 m629(C0288 c0288, ByteOrder byteOrder) {
            C0288[] c0288Arr = {c0288};
            ByteBuffer wrap = ByteBuffer.wrap(new byte[C0285.f1381[5] * 1]);
            wrap.order(byteOrder);
            for (int i = 0; i < 1; i++) {
                C0288 c02882 = c0288Arr[i];
                wrap.putInt((int) c02882.f1429);
                wrap.putInt((int) c02882.f1430);
            }
            return new C0287(5, 1, wrap.array());
        }

        public static C0287 m630(long j, ByteOrder byteOrder) {
            long[] jArr = {j};
            ByteBuffer wrap = ByteBuffer.wrap(new byte[C0285.f1381[4] * 1]);
            wrap.order(byteOrder);
            for (int i = 0; i < 1; i++) {
                wrap.putInt((int) jArr[i]);
            }
            return new C0287(4, 1, wrap.array());
        }

        public static C0287 m631(int i, ByteOrder byteOrder) {
            int[] iArr = {i};
            ByteBuffer wrap = ByteBuffer.wrap(new byte[C0285.f1381[3] * 1]);
            wrap.order(byteOrder);
            for (int i2 = 0; i2 < 1; i2++) {
                wrap.putShort((short) iArr[i2]);
            }
            return new C0287(3, 1, wrap.array());
        }

        public String toString() {
            StringBuilder m8071 = C9125.m8071("(");
            m8071.append(C0285.f1392[this.f1426]);
            m8071.append(", data length:");
            return C9125.m8117(m8071, this.f1427.length, ")");
        }

        public double m632(ByteOrder byteOrder) {
            Object m633 = m633(byteOrder);
            if (m633 != null) {
                if (m633 instanceof String) {
                    return Double.parseDouble((String) m633);
                }
                if (m633 instanceof long[]) {
                    long[] jArr = (long[]) m633;
                    if (jArr.length == 1) {
                        return jArr[0];
                    }
                    throw new NumberFormatException("There are more than one component");
                } else if (m633 instanceof int[]) {
                    int[] iArr = (int[]) m633;
                    if (iArr.length == 1) {
                        return iArr[0];
                    }
                    throw new NumberFormatException("There are more than one component");
                } else if (m633 instanceof double[]) {
                    double[] dArr = (double[]) m633;
                    if (dArr.length == 1) {
                        return dArr[0];
                    }
                    throw new NumberFormatException("There are more than one component");
                } else if (m633 instanceof C0288[]) {
                    C0288[] c0288Arr = (C0288[]) m633;
                    if (c0288Arr.length == 1) {
                        C0288 c0288 = c0288Arr[0];
                        return c0288.f1429 / c0288.f1430;
                    }
                    throw new NumberFormatException("There are more than one component");
                } else {
                    throw new NumberFormatException("Couldn't find a double value");
                }
            }
            throw new NumberFormatException("NULL can't be converted to a double value");
        }

        public Object m633(ByteOrder byteOrder) {
            C0289 c0289;
            InputStream inputStream;
            byte b;
            byte[] bArr;
            InputStream inputStream2 = null;
            try {
                try {
                    c0289 = new C0289(this.f1427);
                    try {
                        c0289.f1436 = byteOrder;
                        boolean z = true;
                        int i = 0;
                        switch (this.f1426) {
                            case 1:
                            case 6:
                                byte[] bArr2 = this.f1427;
                                if (bArr2.length == 1 && bArr2[0] >= 0 && bArr2[0] <= 1) {
                                    String str = new String(new char[]{(char) (this.f1427[0] + 48)});
                                    try {
                                        c0289.close();
                                    } catch (IOException e) {
                                        Log.e("ExifInterface", "IOException occurred while closing InputStream", e);
                                    }
                                    return str;
                                }
                                String str2 = new String(this.f1427, C0285.f1407);
                                try {
                                    c0289.close();
                                } catch (IOException e2) {
                                    Log.e("ExifInterface", "IOException occurred while closing InputStream", e2);
                                }
                                return str2;
                            case 2:
                            case 7:
                                if (this.f1428 >= C0285.f1379.length) {
                                    int i2 = 0;
                                    while (true) {
                                        bArr = C0285.f1379;
                                        if (i2 < bArr.length) {
                                            if (this.f1427[i2] != bArr[i2]) {
                                                z = false;
                                            } else {
                                                i2++;
                                            }
                                        }
                                    }
                                    if (z) {
                                        i = bArr.length;
                                    }
                                }
                                StringBuilder sb = new StringBuilder();
                                while (i < this.f1428 && (b = this.f1427[i]) != 0) {
                                    if (b >= 32) {
                                        sb.append((char) b);
                                    } else {
                                        sb.append('?');
                                    }
                                    i++;
                                }
                                String sb2 = sb.toString();
                                try {
                                    c0289.close();
                                } catch (IOException e3) {
                                    Log.e("ExifInterface", "IOException occurred while closing InputStream", e3);
                                }
                                return sb2;
                            case 3:
                                int[] iArr = new int[this.f1428];
                                while (i < this.f1428) {
                                    iArr[i] = c0289.readUnsignedShort();
                                    i++;
                                }
                                try {
                                    c0289.close();
                                } catch (IOException e4) {
                                    Log.e("ExifInterface", "IOException occurred while closing InputStream", e4);
                                }
                                return iArr;
                            case 4:
                                long[] jArr = new long[this.f1428];
                                while (i < this.f1428) {
                                    jArr[i] = c0289.m636();
                                    i++;
                                }
                                try {
                                    c0289.close();
                                } catch (IOException e5) {
                                    Log.e("ExifInterface", "IOException occurred while closing InputStream", e5);
                                }
                                return jArr;
                            case 5:
                                C0288[] c0288Arr = new C0288[this.f1428];
                                while (i < this.f1428) {
                                    c0288Arr[i] = new C0288(c0289.m636(), c0289.m636());
                                    i++;
                                }
                                try {
                                    c0289.close();
                                } catch (IOException e6) {
                                    Log.e("ExifInterface", "IOException occurred while closing InputStream", e6);
                                }
                                return c0288Arr;
                            case 8:
                                int[] iArr2 = new int[this.f1428];
                                while (i < this.f1428) {
                                    iArr2[i] = c0289.readShort();
                                    i++;
                                }
                                try {
                                    c0289.close();
                                } catch (IOException e7) {
                                    Log.e("ExifInterface", "IOException occurred while closing InputStream", e7);
                                }
                                return iArr2;
                            case 9:
                                int[] iArr3 = new int[this.f1428];
                                while (i < this.f1428) {
                                    iArr3[i] = c0289.readInt();
                                    i++;
                                }
                                try {
                                    c0289.close();
                                } catch (IOException e8) {
                                    Log.e("ExifInterface", "IOException occurred while closing InputStream", e8);
                                }
                                return iArr3;
                            case 10:
                                C0288[] c0288Arr2 = new C0288[this.f1428];
                                while (i < this.f1428) {
                                    c0288Arr2[i] = new C0288(c0289.readInt(), c0289.readInt());
                                    i++;
                                }
                                try {
                                    c0289.close();
                                } catch (IOException e9) {
                                    Log.e("ExifInterface", "IOException occurred while closing InputStream", e9);
                                }
                                return c0288Arr2;
                            case 11:
                                double[] dArr = new double[this.f1428];
                                while (i < this.f1428) {
                                    dArr[i] = c0289.readFloat();
                                    i++;
                                }
                                try {
                                    c0289.close();
                                } catch (IOException e10) {
                                    Log.e("ExifInterface", "IOException occurred while closing InputStream", e10);
                                }
                                return dArr;
                            case 12:
                                double[] dArr2 = new double[this.f1428];
                                while (i < this.f1428) {
                                    dArr2[i] = c0289.readDouble();
                                    i++;
                                }
                                try {
                                    c0289.close();
                                } catch (IOException e11) {
                                    Log.e("ExifInterface", "IOException occurred while closing InputStream", e11);
                                }
                                return dArr2;
                            default:
                                try {
                                    c0289.close();
                                } catch (IOException e12) {
                                    Log.e("ExifInterface", "IOException occurred while closing InputStream", e12);
                                }
                                return null;
                        }
                    } catch (IOException e13) {
                        e = e13;
                        Log.w("ExifInterface", "IOException occurred during reading a value", e);
                        if (c0289 != null) {
                            try {
                                c0289.close();
                            } catch (IOException e14) {
                                Log.e("ExifInterface", "IOException occurred while closing InputStream", e14);
                            }
                        }
                        return null;
                    }
                } catch (Throwable th) {
                    th = th;
                    inputStream2 = inputStream;
                    if (inputStream2 != null) {
                        try {
                            inputStream2.close();
                        } catch (IOException e15) {
                            Log.e("ExifInterface", "IOException occurred while closing InputStream", e15);
                        }
                    }
                    throw th;
                }
            } catch (IOException e16) {
                e = e16;
                c0289 = null;
            } catch (Throwable th2) {
                th = th2;
                if (inputStream2 != null) {
                }
                throw th;
            }
        }

        public int m634(ByteOrder byteOrder) {
            Object m633 = m633(byteOrder);
            if (m633 != null) {
                if (m633 instanceof String) {
                    return Integer.parseInt((String) m633);
                }
                if (m633 instanceof long[]) {
                    long[] jArr = (long[]) m633;
                    if (jArr.length == 1) {
                        return (int) jArr[0];
                    }
                    throw new NumberFormatException("There are more than one component");
                } else if (m633 instanceof int[]) {
                    int[] iArr = (int[]) m633;
                    if (iArr.length == 1) {
                        return iArr[0];
                    }
                    throw new NumberFormatException("There are more than one component");
                } else {
                    throw new NumberFormatException("Couldn't find a integer value");
                }
            }
            throw new NumberFormatException("NULL can't be converted to a integer value");
        }

        public String m635(ByteOrder byteOrder) {
            Object m633 = m633(byteOrder);
            if (m633 == null) {
                return null;
            }
            if (m633 instanceof String) {
                return (String) m633;
            }
            StringBuilder sb = new StringBuilder();
            int i = 0;
            if (m633 instanceof long[]) {
                long[] jArr = (long[]) m633;
                while (i < jArr.length) {
                    sb.append(jArr[i]);
                    i++;
                    if (i != jArr.length) {
                        sb.append(",");
                    }
                }
                return sb.toString();
            } else if (m633 instanceof int[]) {
                int[] iArr = (int[]) m633;
                while (i < iArr.length) {
                    sb.append(iArr[i]);
                    i++;
                    if (i != iArr.length) {
                        sb.append(",");
                    }
                }
                return sb.toString();
            } else if (m633 instanceof double[]) {
                double[] dArr = (double[]) m633;
                while (i < dArr.length) {
                    sb.append(dArr[i]);
                    i++;
                    if (i != dArr.length) {
                        sb.append(",");
                    }
                }
                return sb.toString();
            } else if (m633 instanceof C0288[]) {
                C0288[] c0288Arr = (C0288[]) m633;
                while (i < c0288Arr.length) {
                    sb.append(c0288Arr[i].f1429);
                    sb.append('/');
                    sb.append(c0288Arr[i].f1430);
                    i++;
                    if (i != c0288Arr.length) {
                        sb.append(",");
                    }
                }
                return sb.toString();
            } else {
                return null;
            }
        }

        public C0287(int i, int i2, byte[] bArr) {
            this.f1426 = i;
            this.f1428 = i2;
            this.f1427 = bArr;
        }
    }

    public static class C0290 {
        public final int f1437;
        public final int f1438;
        public final String f1439;
        public final int f1440;

        public C0290(String str, int i, int i2) {
            this.f1439 = str;
            this.f1437 = i;
            this.f1438 = i2;
            this.f1440 = -1;
        }

        public C0290(String str, int i, int i2, int i3) {
            this.f1439 = str;
            this.f1437 = i;
            this.f1438 = i2;
            this.f1440 = i3;
        }
    }
}