导航菜单

页面标题

页面副标题

Aisle v12.32 - u.java 源代码

正在查看: Aisle v12.32 应用的 u.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package U0;

import S0.AbstractC0665a;
import S0.L;
import android.content.Context;
import android.content.pm.PackageManager;
import android.content.res.AssetFileDescriptor;
import android.content.res.Resources;
import android.net.Uri;
import android.text.TextUtils;
import java.io.EOFException;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.channels.FileChannel;

public final class u extends b {

    private final Context f8279e;

    private i f8280f;

    private AssetFileDescriptor f8281g;

    private InputStream f8282h;

    private long f8283i;

    private boolean f8284j;

    public static class a extends f {
        public a(String str, Throwable th, int i5) {
            super(str, th, i5);
        }
    }

    public u(Context context) {
        super(false);
        this.f8279e = context.getApplicationContext();
    }

    @Deprecated
    public static Uri buildRawResourceUri(int i5) {
        return Uri.parse("rawresource:///" + i5);
    }

    private static AssetFileDescriptor t(Context context, i iVar) {
        Resources resources;
        int parseInt;
        Uri normalizeScheme = iVar.f8205a.normalizeScheme();
        if (TextUtils.equals("rawresource", normalizeScheme.getScheme()) || (TextUtils.equals("android.resource", normalizeScheme.getScheme()) && normalizeScheme.getPathSegments().size() == 1 && ((String) AbstractC0665a.e(normalizeScheme.getLastPathSegment())).matches("\\d+"))) {
            resources = context.getResources();
            try {
                parseInt = Integer.parseInt((String) AbstractC0665a.e(normalizeScheme.getLastPathSegment()));
            } catch (NumberFormatException unused) {
                throw new a("Resource identifier must be an integer.", null, 1004);
            }
        } else {
            if (!TextUtils.equals("android.resource", normalizeScheme.getScheme())) {
                throw new a("Unsupported URI scheme (" + normalizeScheme.getScheme() + "). Only android.resource is supported.", null, 1004);
            }
            String str = (String) AbstractC0665a.e(normalizeScheme.getPath());
            if (str.startsWith("/")) {
                str = str.substring(1);
            }
            String packageName = TextUtils.isEmpty(normalizeScheme.getHost()) ? context.getPackageName() : normalizeScheme.getHost();
            if (packageName.equals(context.getPackageName())) {
                resources = context.getResources();
            } else {
                try {
                    resources = context.getPackageManager().getResourcesForApplication(packageName);
                } catch (PackageManager.NameNotFoundException e5) {
                    throw new a("Package in android.resource:// URI not found. Check http://g.co/dev/packagevisibility.", e5, 2005);
                }
            }
            parseInt = resources.getIdentifier(packageName + ":" + str, "raw", null);
            if (parseInt == 0) {
                throw new a("Resource not found.", null, 2005);
            }
        }
        try {
            AssetFileDescriptor openRawResourceFd = resources.openRawResourceFd(parseInt);
            if (openRawResourceFd != null) {
                return openRawResourceFd;
            }
            throw new a("Resource is compressed: " + normalizeScheme, null, 2000);
        } catch (Resources.NotFoundException e6) {
            throw new a(null, e6, 2005);
        }
    }

    @Override
    public void close() {
        this.f8280f = null;
        try {
            try {
                InputStream inputStream = this.f8282h;
                if (inputStream != null) {
                    inputStream.close();
                }
                this.f8282h = null;
                try {
                    try {
                        AssetFileDescriptor assetFileDescriptor = this.f8281g;
                        if (assetFileDescriptor != null) {
                            assetFileDescriptor.close();
                        }
                    } catch (IOException e5) {
                        throw new a(null, e5, 2000);
                    }
                } finally {
                    this.f8281g = null;
                    if (this.f8284j) {
                        this.f8284j = false;
                        q();
                    }
                }
            } catch (IOException e6) {
                throw new a(null, e6, 2000);
            }
        } catch (Throwable th) {
            this.f8282h = null;
            try {
                try {
                    AssetFileDescriptor assetFileDescriptor2 = this.f8281g;
                    if (assetFileDescriptor2 != null) {
                        assetFileDescriptor2.close();
                    }
                    this.f8281g = null;
                    if (this.f8284j) {
                        this.f8284j = false;
                        q();
                    }
                    throw th;
                } catch (IOException e7) {
                    throw new a(null, e7, 2000);
                }
            } finally {
                this.f8281g = null;
                if (this.f8284j) {
                    this.f8284j = false;
                    q();
                }
            }
        }
    }

    @Override
    public long h(i iVar) {
        this.f8280f = iVar;
        r(iVar);
        AssetFileDescriptor t5 = t(this.f8279e, iVar);
        this.f8281g = t5;
        long length = t5.getLength();
        FileInputStream fileInputStream = new FileInputStream(this.f8281g.getFileDescriptor());
        this.f8282h = fileInputStream;
        if (length != -1) {
            try {
                if (iVar.f8211g > length) {
                    throw new a(null, null, 2008);
                }
            } catch (a e5) {
                throw e5;
            } catch (IOException e6) {
                throw new a(null, e6, 2000);
            }
        }
        long startOffset = this.f8281g.getStartOffset();
        long skip = fileInputStream.skip(iVar.f8211g + startOffset) - startOffset;
        if (skip != iVar.f8211g) {
            throw new a(null, null, 2008);
        }
        if (length == -1) {
            FileChannel channel = fileInputStream.getChannel();
            if (channel.size() == 0) {
                this.f8283i = -1L;
            } else {
                long size = channel.size() - channel.position();
                this.f8283i = size;
                if (size < 0) {
                    throw new a(null, null, 2008);
                }
            }
        } else {
            long j5 = length - skip;
            this.f8283i = j5;
            if (j5 < 0) {
                throw new f(2008);
            }
        }
        long j6 = iVar.f8212h;
        if (j6 != -1) {
            long j7 = this.f8283i;
            if (j7 != -1) {
                j6 = Math.min(j7, j6);
            }
            this.f8283i = j6;
        }
        this.f8284j = true;
        s(iVar);
        long j8 = iVar.f8212h;
        return j8 != -1 ? j8 : this.f8283i;
    }

    @Override
    public Uri n() {
        i iVar = this.f8280f;
        if (iVar != null) {
            return iVar.f8205a;
        }
        return null;
    }

    @Override
    public int read(byte[] bArr, int i5, int i6) {
        if (i6 == 0) {
            return 0;
        }
        long j5 = this.f8283i;
        if (j5 == 0) {
            return -1;
        }
        if (j5 != -1) {
            try {
                i6 = (int) Math.min(j5, i6);
            } catch (IOException e5) {
                throw new a(null, e5, 2000);
            }
        }
        int read = ((InputStream) L.h(this.f8282h)).read(bArr, i5, i6);
        if (read == -1) {
            if (this.f8283i == -1) {
                return -1;
            }
            throw new a("End of stream reached having not read sufficient data.", new EOFException(), 2000);
        }
        long j6 = this.f8283i;
        if (j6 != -1) {
            this.f8283i = j6 - read;
        }
        p(read);
        return read;
    }
}