package ඓ.ῲ.K.ᕣ.ᕣ.ʬ;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.ParcelFileDescriptor;
import com.bumptech.glide.load.ImageHeaderParser;
import com.bumptech.glide.load.resource.bitmap.RecyclableBufferedInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import ඓ.ῲ.K.ᕣ.ᨨ.ゎ.AbstractC0967;
import ඓ.ῲ.K.ᕣ.㿎.C1132;
import ඓ.ῲ.K.ᕣ.㿎.C1149;
import ῲ.ᨨ.㳳.C1841;

/* renamed from: ඓ.ῲ.K.ᕣ.ᕣ.ʬ.ᓣ  reason: contains not printable characters */
/* compiled from: ImageReader */
public interface AbstractC0870 {

    /* renamed from: ඓ.ῲ.K.ᕣ.ᕣ.ʬ.ᓣ$K  reason: contains not printable characters */
    /* compiled from: ImageReader */
    public static final class C0872 implements AbstractC0870 {

        /* renamed from: ʬ  reason: contains not printable characters */
        public final List<ImageHeaderParser> f4114;

        /* renamed from: ῲ  reason: contains not printable characters */
        public final AbstractC0967 f4115;

        /* renamed from: K  reason: contains not printable characters */
        public final C1132 f4116;

        public C0872(InputStream inputStream, List<ImageHeaderParser> list, AbstractC0967 r4) {
            C1841.m4783(r4, "Argument must not be null");
            this.f4115 = r4;
            C1841.m4783(list, "Argument must not be null");
            this.f4114 = list;
            this.f4116 = new C1132(inputStream, r4);
        }

        @Override // ඓ.ῲ.K.ᕣ.ᕣ.ʬ.AbstractC0870
        /* renamed from: ʬ  reason: contains not printable characters */
        public int m2517() throws IOException {
            return C1841.m4772(this.f4114, this.f4116.m3029(), this.f4115);
        }

        @Override // ඓ.ῲ.K.ᕣ.ᕣ.ʬ.AbstractC0870
        /* renamed from: ῲ  reason: contains not printable characters */
        public void m2518() {
            this.f4116.f4604.m1328();
        }

        @Override // ඓ.ῲ.K.ᕣ.ᕣ.ʬ.AbstractC0870
        /* renamed from: K  reason: contains not printable characters */
        public Bitmap m2519(BitmapFactory.Options options) throws IOException {
            return BitmapFactory.decodeStream(this.f4116.m3029(), null, options);
        }

        @Override // ඓ.ῲ.K.ᕣ.ᕣ.ʬ.AbstractC0870
        /* renamed from: K  reason: contains not printable characters */
        public ImageHeaderParser.ImageType m2520() throws IOException {
            return C1841.m4755(this.f4114, this.f4116.m3029(), this.f4115);
        }
    }

    /* renamed from: ʬ  reason: contains not printable characters */
    int m2509() throws IOException;

    /* renamed from: ῲ  reason: contains not printable characters */
    void m2510();

    /* renamed from: K  reason: contains not printable characters */
    Bitmap m2511(BitmapFactory.Options options) throws IOException;

    /* renamed from: K  reason: contains not printable characters */
    ImageHeaderParser.ImageType m2512() throws IOException;

    /* renamed from: ඓ.ῲ.K.ᕣ.ᕣ.ʬ.ᓣ$ῲ  reason: contains not printable characters */
    /* compiled from: ImageReader */
    public static final class C0871 implements AbstractC0870 {

        /* renamed from: ʬ  reason: contains not printable characters */
        public final C1149 f4111;

        /* renamed from: ῲ  reason: contains not printable characters */
        public final List<ImageHeaderParser> f4112;

        /* renamed from: K  reason: contains not printable characters */
        public final AbstractC0967 f4113;

        public C0871(ParcelFileDescriptor parcelFileDescriptor, List<ImageHeaderParser> list, AbstractC0967 r4) {
            C1841.m4783(r4, "Argument must not be null");
            this.f4113 = r4;
            C1841.m4783(list, "Argument must not be null");
            this.f4112 = list;
            this.f4111 = new C1149(parcelFileDescriptor);
        }

        /* JADX WARNING: Removed duplicated region for block: B:19:0x0040 A[SYNTHETIC, Splitter:B:19:0x0040] */
        @Override // ඓ.ῲ.K.ᕣ.ᕣ.ʬ.AbstractC0870
        /* renamed from: ʬ  reason: contains not printable characters */
        public int m2513() throws IOException {
            Throwable th;
            List<ImageHeaderParser> list = this.f4112;
            C1149 r1 = this.f4111;
            AbstractC0967 r2 = this.f4113;
            int size = list.size();
            for (int i = 0; i < size; i++) {
                ImageHeaderParser imageHeaderParser = list.get(i);
                RecyclableBufferedInputStream recyclableBufferedInputStream = null;
                try {
                    RecyclableBufferedInputStream recyclableBufferedInputStream2 = new RecyclableBufferedInputStream(new FileInputStream(r1.m3075().getFileDescriptor()), r2);
                    try {
                        int r6 = imageHeaderParser.m1266(recyclableBufferedInputStream2, r2);
                        try {
                            recyclableBufferedInputStream2.close();
                        } catch (IOException unused) {
                        }
                        r1.m3075();
                        if (r6 != -1) {
                            return r6;
                        }
                    } catch (Throwable th2) {
                        th = th2;
                        recyclableBufferedInputStream = recyclableBufferedInputStream2;
                        if (recyclableBufferedInputStream != null) {
                            try {
                                recyclableBufferedInputStream.close();
                            } catch (IOException unused2) {
                            }
                        }
                        r1.m3075();
                        throw th;
                    }
                } catch (Throwable th3) {
                    th = th3;
                    if (recyclableBufferedInputStream != null) {
                    }
                    r1.m3075();
                    throw th;
                }
            }
            return -1;
        }

        @Override // ඓ.ῲ.K.ᕣ.ᕣ.ʬ.AbstractC0870
        /* renamed from: ῲ  reason: contains not printable characters */
        public void m2514() {
        }

        @Override // ඓ.ῲ.K.ᕣ.ᕣ.ʬ.AbstractC0870
        /* renamed from: K  reason: contains not printable characters */
        public Bitmap m2515(BitmapFactory.Options options) throws IOException {
            return BitmapFactory.decodeFileDescriptor(this.f4111.m3075().getFileDescriptor(), null, options);
        }

        /* JADX WARNING: Removed duplicated region for block: B:17:0x0040 A[SYNTHETIC, Splitter:B:17:0x0040] */
        @Override // ඓ.ῲ.K.ᕣ.ᕣ.ʬ.AbstractC0870
        /* renamed from: K  reason: contains not printable characters */
        public ImageHeaderParser.ImageType m2516() throws IOException {
            Throwable th;
            List<ImageHeaderParser> list = this.f4112;
            C1149 r1 = this.f4111;
            AbstractC0967 r2 = this.f4113;
            int size = list.size();
            for (int i = 0; i < size; i++) {
                ImageHeaderParser imageHeaderParser = list.get(i);
                RecyclableBufferedInputStream recyclableBufferedInputStream = null;
                try {
                    RecyclableBufferedInputStream recyclableBufferedInputStream2 = new RecyclableBufferedInputStream(new FileInputStream(r1.m3075().getFileDescriptor()), r2);
                    try {
                        ImageHeaderParser.ImageType r5 = imageHeaderParser.m1267(recyclableBufferedInputStream2);
                        try {
                            recyclableBufferedInputStream2.close();
                        } catch (IOException unused) {
                        }
                        r1.m3075();
                        if (r5 != ImageHeaderParser.ImageType.UNKNOWN) {
                            return r5;
                        }
                    } catch (Throwable th2) {
                        th = th2;
                        recyclableBufferedInputStream = recyclableBufferedInputStream2;
                        if (recyclableBufferedInputStream != null) {
                            try {
                                recyclableBufferedInputStream.close();
                            } catch (IOException unused2) {
                            }
                        }
                        r1.m3075();
                        throw th;
                    }
                } catch (Throwable th3) {
                    th = th3;
                    if (recyclableBufferedInputStream != null) {
                    }
                    r1.m3075();
                    throw th;
                }
            }
            return ImageHeaderParser.ImageType.UNKNOWN;
        }
    }
}
