导航菜单

页面标题

页面副标题

JetMelo v1.0 - C.java 源代码

正在查看: JetMelo v1.0 应用的 C.java JAVA 源代码文件

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


package H1;

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.nio.channels.FileChannel;
import java.util.List;

public final class C extends AbstractC0348c {

    public final Context f4471k;

    public o f4472l;

    public AssetFileDescriptor f4473m;

    public FileInputStream f4474n;

    public long f4475o;

    public boolean f4476p;

    public C(Context context) {
        super(false);
        this.f4471k = context.getApplicationContext();
    }

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

    @Override
    public final void close() {
        this.f4472l = null;
        try {
            try {
                FileInputStream fileInputStream = this.f4474n;
                if (fileInputStream != null) {
                    fileInputStream.close();
                }
                this.f4474n = null;
                try {
                    try {
                        AssetFileDescriptor assetFileDescriptor = this.f4473m;
                        if (assetFileDescriptor != null) {
                            assetFileDescriptor.close();
                        }
                    } catch (IOException e6) {
                        throw new B(null, e6, 2000);
                    }
                } finally {
                    this.f4473m = null;
                    if (this.f4476p) {
                        this.f4476p = false;
                        h();
                    }
                }
            } catch (IOException e7) {
                throw new B(null, e7, 2000);
            }
        } catch (Throwable th) {
            this.f4474n = null;
            try {
                try {
                    AssetFileDescriptor assetFileDescriptor2 = this.f4473m;
                    if (assetFileDescriptor2 != null) {
                        assetFileDescriptor2.close();
                    }
                    this.f4473m = null;
                    if (this.f4476p) {
                        this.f4476p = false;
                        h();
                    }
                    throw th;
                } catch (IOException e8) {
                    throw new B(null, e8, 2000);
                }
            } finally {
                this.f4473m = null;
                if (this.f4476p) {
                    this.f4476p = false;
                    h();
                }
            }
        }
    }

    @Override
    public final Uri i() {
        o oVar = this.f4472l;
        if (oVar != null) {
            return oVar.f4535a;
        }
        return null;
    }

    @Override
    public final long m(o oVar) {
        Resources resourcesForApplication;
        int parseInt;
        int i6;
        Resources resources;
        this.f4472l = oVar;
        l();
        Uri normalizeScheme = oVar.f4535a.normalizeScheme();
        boolean equals = TextUtils.equals("rawresource", normalizeScheme.getScheme());
        Context context = this.f4471k;
        if (equals) {
            resources = context.getResources();
            List<String> pathSegments = normalizeScheme.getPathSegments();
            if (pathSegments.size() != 1) {
                throw new B("rawresource:// URI must have exactly one path element, found " + pathSegments.size(), null, 2000);
            }
            try {
                i6 = Integer.parseInt(pathSegments.get(0));
            } catch (NumberFormatException unused) {
                throw new B("Resource identifier must be an integer.", null, 1004);
            }
        } else {
            if (!TextUtils.equals("android.resource", normalizeScheme.getScheme())) {
                throw new B("Unsupported URI scheme (" + normalizeScheme.getScheme() + "). Only android.resource is supported.", null, 1004);
            }
            String path = normalizeScheme.getPath();
            path.getClass();
            if (path.startsWith("/")) {
                path = path.substring(1);
            }
            String packageName = TextUtils.isEmpty(normalizeScheme.getHost()) ? context.getPackageName() : normalizeScheme.getHost();
            if (packageName.equals(context.getPackageName())) {
                resourcesForApplication = context.getResources();
            } else {
                try {
                    resourcesForApplication = context.getPackageManager().getResourcesForApplication(packageName);
                } catch (PackageManager.NameNotFoundException e6) {
                    throw new B("Package in android.resource:// URI not found. Check http://g.co/dev/packagevisibility.", e6, 2005);
                }
            }
            if (path.matches("\\d+")) {
                try {
                    parseInt = Integer.parseInt(path);
                } catch (NumberFormatException unused2) {
                    throw new B("Resource identifier must be an integer.", null, 1004);
                }
            } else {
                parseInt = resourcesForApplication.getIdentifier(packageName + ":" + path, "raw", null);
                if (parseInt == 0) {
                    throw new B("Resource not found.", null, 2005);
                }
            }
            i6 = parseInt;
            resources = resourcesForApplication;
        }
        try {
            AssetFileDescriptor openRawResourceFd = resources.openRawResourceFd(i6);
            if (openRawResourceFd == null) {
                throw new B("Resource is compressed: " + normalizeScheme, null, 2000);
            }
            this.f4473m = openRawResourceFd;
            long length = openRawResourceFd.getLength();
            FileInputStream fileInputStream = new FileInputStream(this.f4473m.getFileDescriptor());
            this.f4474n = fileInputStream;
            long j6 = oVar.f4539e;
            try {
                if (length != -1 && j6 > length) {
                    throw new B(null, null, 2008);
                }
                long startOffset = this.f4473m.getStartOffset();
                long skip = fileInputStream.skip(startOffset + j6) - startOffset;
                if (skip != j6) {
                    throw new B(null, null, 2008);
                }
                if (length == -1) {
                    FileChannel channel = fileInputStream.getChannel();
                    if (channel.size() == 0) {
                        this.f4475o = -1L;
                    } else {
                        long size = channel.size() - channel.position();
                        this.f4475o = size;
                        if (size < 0) {
                            throw new B(null, null, 2008);
                        }
                    }
                } else {
                    long j7 = length - skip;
                    this.f4475o = j7;
                    if (j7 < 0) {
                        throw new l(2008);
                    }
                }
                long j8 = oVar.f4540f;
                if (j8 != -1) {
                    long j9 = this.f4475o;
                    this.f4475o = j9 == -1 ? j8 : Math.min(j9, j8);
                }
                this.f4476p = true;
                r(oVar);
                return j8 != -1 ? j8 : this.f4475o;
            } catch (B e7) {
                throw e7;
            } catch (IOException e8) {
                throw new B(null, e8, 2000);
            }
        } catch (Resources.NotFoundException e9) {
            throw new B(null, e9, 2005);
        }
    }

    @Override
    public final int p(byte[] bArr, int i6, int i7) {
        if (i7 == 0) {
            return 0;
        }
        long j6 = this.f4475o;
        if (j6 != 0) {
            if (j6 != -1) {
                try {
                    i7 = (int) Math.min(j6, i7);
                } catch (IOException e6) {
                    throw new B(null, e6, 2000);
                }
            }
            FileInputStream fileInputStream = this.f4474n;
            int i8 = F1.C.f3818a;
            int read = fileInputStream.read(bArr, i6, i7);
            if (read != -1) {
                long j7 = this.f4475o;
                if (j7 != -1) {
                    this.f4475o = j7 - read;
                }
                d(read);
                return read;
            }
            if (this.f4475o != -1) {
                throw new B("End of stream reached having not read sufficient data.", new EOFException(), 2000);
            }
        }
        return -1;
    }
}