导航菜单

页面标题

页面副标题

Housing v14.7.8 - v.java 源代码

正在查看: Housing v14.7.8 应用的 v.java JAVA 源代码文件

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


package u2;

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 androidx.annotation.Nullable;
import androidx.camera.camera2.internal.t2;
import androidx.media3.common.PlaybackException;
import androidx.media3.common.util.UnstableApi;
import androidx.media3.common.util.h0;
import androidx.media3.datasource.DataSpec;
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;

@UnstableApi
public final class v extends b {

    @Deprecated
    public static final String RAW_RESOURCE_SCHEME = "rawresource";
    private final Context applicationContext;

    @Nullable
    private AssetFileDescriptor assetFileDescriptor;
    private long bytesRemaining;

    @Nullable
    private DataSpec dataSpec;

    @Nullable
    private InputStream inputStream;
    private boolean opened;

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

        @Deprecated
        public a(Throwable th) {
            super(th, 2000);
        }

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

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

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

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

    @Override
    public final Uri getUri() {
        DataSpec dataSpec = this.dataSpec;
        if (dataSpec != null) {
            return dataSpec.uri;
        }
        return null;
    }

    @Override
    public final long j(DataSpec dataSpec) {
        Resources resourcesForApplication;
        int parseInt;
        this.dataSpec = dataSpec;
        o();
        Context context = this.applicationContext;
        Uri normalizeScheme = dataSpec.uri.normalizeScheme();
        if (TextUtils.equals(RAW_RESOURCE_SCHEME, normalizeScheme.getScheme())) {
            resourcesForApplication = 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());
            }
            try {
                parseInt = Integer.parseInt(pathSegments.get(0));
            } 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 path = normalizeScheme.getPath();
            path.getClass();
            if (path.startsWith(y1.c.SEPARATOR)) {
                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 e5) {
                    throw new a("Package in android.resource:// URI not found. Check http://g.co/dev/packagevisibility.", e5, PlaybackException.ERROR_CODE_IO_FILE_NOT_FOUND);
                }
            }
            if (path.matches("\\d+")) {
                try {
                    parseInt = Integer.parseInt(path);
                } catch (NumberFormatException unused2) {
                    throw new a("Resource identifier must be an integer.", null, 1004);
                }
            } else {
                parseInt = resourcesForApplication.getIdentifier(t2.D(packageName, ":", path), "raw", null);
                if (parseInt == 0) {
                    throw new a("Resource not found.", null, PlaybackException.ERROR_CODE_IO_FILE_NOT_FOUND);
                }
            }
        }
        try {
            AssetFileDescriptor openRawResourceFd = resourcesForApplication.openRawResourceFd(parseInt);
            if (openRawResourceFd == null) {
                throw new a(defpackage.a.k(normalizeScheme, "Resource is compressed: "), null, 2000);
            }
            this.assetFileDescriptor = openRawResourceFd;
            long length = openRawResourceFd.getLength();
            FileInputStream fileInputStream = new FileInputStream(this.assetFileDescriptor.getFileDescriptor());
            this.inputStream = fileInputStream;
            if (length != -1) {
                try {
                    if (dataSpec.position > length) {
                        throw new a(null, null, 2008);
                    }
                } catch (a e6) {
                    throw e6;
                } catch (IOException e7) {
                    throw new a(null, e7, 2000);
                }
            }
            long startOffset = this.assetFileDescriptor.getStartOffset();
            long skip = fileInputStream.skip(dataSpec.position + startOffset) - startOffset;
            if (skip != dataSpec.position) {
                throw new a(null, null, 2008);
            }
            if (length == -1) {
                FileChannel channel = fileInputStream.getChannel();
                if (channel.size() == 0) {
                    this.bytesRemaining = -1L;
                } else {
                    long size = channel.size() - channel.position();
                    this.bytesRemaining = size;
                    if (size < 0) {
                        throw new a(null, null, 2008);
                    }
                }
            } else {
                long j5 = length - skip;
                this.bytesRemaining = j5;
                if (j5 < 0) {
                    throw new h(2008);
                }
            }
            long j6 = dataSpec.length;
            if (j6 != -1) {
                long j7 = this.bytesRemaining;
                if (j7 != -1) {
                    j6 = Math.min(j7, j6);
                }
                this.bytesRemaining = j6;
            }
            this.opened = true;
            p(dataSpec);
            long j8 = dataSpec.length;
            return j8 != -1 ? j8 : this.bytesRemaining;
        } catch (Resources.NotFoundException e8) {
            throw new a(null, e8, PlaybackException.ERROR_CODE_IO_FILE_NOT_FOUND);
        }
    }

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