导航菜单

页面标题

页面副标题

Sandridge Go v2025.2.170190457 - v.java 源代码

正在查看: Sandridge Go v2025.2.170190457 应用的 v.java JAVA 源代码文件

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


package u1;

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;
import java.util.List;
import s1.AbstractC1672a;
import s1.P;

public final class v extends AbstractC1733b {

    private final Context f23377e;

    private n f23378f;

    private AssetFileDescriptor f23379g;

    private InputStream f23380h;

    private long f23381i;

    private boolean f23382j;

    public static class a extends k {
        public a(String str) {
            super(str, null, 2000);
        }

        public a(String str, Throwable th, int i5) {
            super(str, th, i5);
        }
    }

    public v(Context context) {
        super(false);
        this.f23377e = context.getApplicationContext();
    }

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

    private static AssetFileDescriptor s(Context context, n nVar) {
        Resources n5;
        int identifier;
        Uri normalizeScheme = nVar.f23301a.normalizeScheme();
        if (TextUtils.equals("rawresource", normalizeScheme.getScheme())) {
            n5 = context.getResources();
            List<String> pathSegments = normalizeScheme.getPathSegments();
            if (pathSegments.size() != 1) {
                throw new a("rawresource:// URI must have exactly one path element, found " + pathSegments.size());
            }
            identifier = t(pathSegments.get(0));
        } 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) AbstractC1672a.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())) {
                n5 = context.getResources();
            } else {
                try {
                    n5 = m5.a.n(context.getPackageManager(), packageName);
                } catch (PackageManager.NameNotFoundException e6) {
                    throw new a("Package in android.resource:// URI not found. Check http://g.co/dev/packagevisibility.", e6, 2005);
                }
            }
            if (str.matches("\\d+")) {
                identifier = t(str);
            } else {
                identifier = n5.getIdentifier(packageName + ":" + str, "raw", null);
                if (identifier == 0) {
                    throw new a("Resource not found.", null, 2005);
                }
            }
        }
        try {
            AssetFileDescriptor openRawResourceFd = n5.openRawResourceFd(identifier);
            if (openRawResourceFd != null) {
                return openRawResourceFd;
            }
            throw new a("Resource is compressed: " + normalizeScheme, null, 2000);
        } catch (Resources.NotFoundException e7) {
            throw new a(null, e7, 2005);
        }
    }

    private static int t(String str) {
        try {
            return Integer.parseInt(str);
        } catch (NumberFormatException unused) {
            throw new a("Resource identifier must be an integer.", null, 1004);
        }
    }

    @Override
    public int b(byte[] bArr, int i5, int i6) {
        if (i6 == 0) {
            return 0;
        }
        long j5 = this.f23381i;
        if (j5 == 0) {
            return -1;
        }
        if (j5 != -1) {
            try {
                i6 = (int) Math.min(j5, i6);
            } catch (IOException e6) {
                throw new a(null, e6, 2000);
            }
        }
        int read = ((InputStream) P.l(this.f23380h)).read(bArr, i5, i6);
        if (read == -1) {
            if (this.f23381i == -1) {
                return -1;
            }
            throw new a("End of stream reached having not read sufficient data.", new EOFException(), 2000);
        }
        long j6 = this.f23381i;
        if (j6 != -1) {
            this.f23381i = j6 - read;
        }
        o(read);
        return read;
    }

    @Override
    public void close() {
        this.f23378f = null;
        try {
            try {
                InputStream inputStream = this.f23380h;
                if (inputStream != null) {
                    inputStream.close();
                }
                this.f23380h = null;
                try {
                    try {
                        AssetFileDescriptor assetFileDescriptor = this.f23379g;
                        if (assetFileDescriptor != null) {
                            assetFileDescriptor.close();
                        }
                    } catch (IOException e6) {
                        throw new a(null, e6, 2000);
                    }
                } finally {
                    this.f23379g = null;
                    if (this.f23382j) {
                        this.f23382j = false;
                        p();
                    }
                }
            } catch (IOException e7) {
                throw new a(null, e7, 2000);
            }
        } catch (Throwable th) {
            this.f23380h = null;
            try {
                try {
                    AssetFileDescriptor assetFileDescriptor2 = this.f23379g;
                    if (assetFileDescriptor2 != null) {
                        assetFileDescriptor2.close();
                    }
                    this.f23379g = null;
                    if (this.f23382j) {
                        this.f23382j = false;
                        p();
                    }
                    throw th;
                } catch (IOException e8) {
                    throw new a(null, e8, 2000);
                }
            } finally {
                this.f23379g = null;
                if (this.f23382j) {
                    this.f23382j = false;
                    p();
                }
            }
        }
    }

    @Override
    public long f(n nVar) {
        this.f23378f = nVar;
        q(nVar);
        AssetFileDescriptor s5 = s(this.f23377e, nVar);
        this.f23379g = s5;
        long length = s5.getLength();
        FileInputStream fileInputStream = new FileInputStream(this.f23379g.getFileDescriptor());
        this.f23380h = fileInputStream;
        if (length != -1) {
            try {
                if (nVar.f23307g > length) {
                    throw new a(null, null, 2008);
                }
            } catch (a e6) {
                throw e6;
            } catch (IOException e7) {
                throw new a(null, e7, 2000);
            }
        }
        long startOffset = this.f23379g.getStartOffset();
        long skip = fileInputStream.skip(nVar.f23307g + startOffset) - startOffset;
        if (skip != nVar.f23307g) {
            throw new a(null, null, 2008);
        }
        if (length == -1) {
            FileChannel channel = fileInputStream.getChannel();
            if (channel.size() == 0) {
                this.f23381i = -1L;
            } else {
                long size = channel.size() - channel.position();
                this.f23381i = size;
                if (size < 0) {
                    throw new a(null, null, 2008);
                }
            }
        } else {
            long j5 = length - skip;
            this.f23381i = j5;
            if (j5 < 0) {
                throw new k(2008);
            }
        }
        long j6 = nVar.f23308h;
        if (j6 != -1) {
            long j7 = this.f23381i;
            if (j7 != -1) {
                j6 = Math.min(j7, j6);
            }
            this.f23381i = j6;
        }
        this.f23382j = true;
        r(nVar);
        long j8 = nVar.f23308h;
        return j8 != -1 ? j8 : this.f23381i;
    }

    @Override
    public Uri m() {
        n nVar = this.f23378f;
        if (nVar != null) {
            return nVar.f23301a;
        }
        return null;
    }
}