package ඓ.ῲ.K.ᕣ.㿎;

import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;
import ඓ.K.K.K.C1293;

/* renamed from: ඓ.ῲ.K.ᕣ.㿎.ⁱ  reason: contains not printable characters */
/* compiled from: ExifOrientationStream */
public final class C1136 extends FilterInputStream {

    /* renamed from: ඓ  reason: contains not printable characters */
    public static final int f4609 = f4611.length;

    /* renamed from: 㴹  reason: contains not printable characters */
    public static final int f4610 = (f4609 + 2);

    /* renamed from: 㸾  reason: contains not printable characters */
    public static final byte[] f4611 = {-1, -31, 0, 28, 69, 120, 105, 102, 0, 0, 77, 77, 0, 0, 0, 0, 0, 8, 0, 1, 1, 18, 0, 2, 0, 0, 0, 1, 0};

    /* renamed from: ʬ  reason: contains not printable characters */
    public int f4612;

    /* renamed from: ῲ  reason: contains not printable characters */
    public final byte f4613;

    public C1136(InputStream inputStream, int i) {
        super(inputStream);
        if (i < -1 || i > 8) {
            throw new IllegalArgumentException(C1293.m3408("Cannot add invalid orientation: ", i));
        }
        this.f4613 = (byte) i;
    }

    public void mark(int i) {
        throw new UnsupportedOperationException();
    }

    public boolean markSupported() {
        return false;
    }

    @Override // java.io.FilterInputStream, java.io.InputStream
    public int read() throws IOException {
        int i;
        int i2;
        int i3 = this.f4612;
        if (i3 < 2 || i3 > (i2 = f4610)) {
            i = super.read();
        } else if (i3 == i2) {
            i = this.f4613;
        } else {
            i = f4611[i3 - 2] & 255;
        }
        if (i != -1) {
            this.f4612++;
        }
        return i;
    }

    @Override // java.io.FilterInputStream, java.io.InputStream
    public void reset() throws IOException {
        throw new UnsupportedOperationException();
    }

    @Override // java.io.FilterInputStream, java.io.InputStream
    public long skip(long j) throws IOException {
        long skip = super.skip(j);
        if (skip > 0) {
            this.f4612 = (int) (((long) this.f4612) + skip);
        }
        return skip;
    }

    @Override // java.io.FilterInputStream, java.io.InputStream
    public int read(byte[] bArr, int i, int i2) throws IOException {
        int i3;
        int i4 = this.f4612;
        int i5 = f4610;
        if (i4 > i5) {
            i3 = super.read(bArr, i, i2);
        } else if (i4 == i5) {
            bArr[i] = this.f4613;
            i3 = 1;
        } else if (i4 < 2) {
            i3 = super.read(bArr, i, 2 - i4);
        } else {
            int min = Math.min(i5 - i4, i2);
            System.arraycopy(f4611, this.f4612 - 2, bArr, i, min);
            i3 = min;
        }
        if (i3 > 0) {
            this.f4612 += i3;
        }
        return i3;
    }
}
