正在查看: Perplexity v2.48.1 应用的 q.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Perplexity v2.48.1 应用的 q.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package e8;
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.media3.datasource.DataSourceException;
import androidx.media3.datasource.RawResourceDataSource$RawResourceDataSourceException;
import c8.y;
import java.io.EOFException;
import java.io.FileInputStream;
import java.io.IOException;
import java.nio.channels.FileChannel;
import java.util.List;
import u2.AbstractC4227a;
public final class q extends AbstractC2077b {
public final Context f27231X;
public j f27232Y;
public AssetFileDescriptor f27233Z;
public FileInputStream f27234r0;
public long f27235s0;
public boolean f27236t0;
public q(Context context) {
super(false);
this.f27231X = context.getApplicationContext();
}
@Deprecated
public static Uri buildRawResourceUri(int i10) {
return Uri.parse("rawresource:///" + i10);
}
@Override
public final void close() {
this.f27232Y = null;
try {
try {
FileInputStream fileInputStream = this.f27234r0;
if (fileInputStream != null) {
fileInputStream.close();
}
this.f27234r0 = null;
try {
try {
AssetFileDescriptor assetFileDescriptor = this.f27233Z;
if (assetFileDescriptor != null) {
assetFileDescriptor.close();
}
} catch (IOException e10) {
throw new RawResourceDataSource$RawResourceDataSourceException(null, e10, 2000);
}
} finally {
this.f27233Z = null;
if (this.f27236t0) {
this.f27236t0 = false;
l();
}
}
} catch (IOException e11) {
throw new RawResourceDataSource$RawResourceDataSourceException(null, e11, 2000);
}
} catch (Throwable th) {
this.f27234r0 = null;
try {
try {
AssetFileDescriptor assetFileDescriptor2 = this.f27233Z;
if (assetFileDescriptor2 != null) {
assetFileDescriptor2.close();
}
this.f27233Z = null;
if (this.f27236t0) {
this.f27236t0 = false;
l();
}
throw th;
} catch (IOException e12) {
throw new RawResourceDataSource$RawResourceDataSourceException(null, e12, 2000);
}
} finally {
this.f27233Z = null;
if (this.f27236t0) {
this.f27236t0 = false;
l();
}
}
}
}
@Override
public final Uri i() {
j jVar = this.f27232Y;
if (jVar != null) {
return jVar.f27193a;
}
return null;
}
@Override
public final long j(j jVar) {
Resources resourcesForApplication;
int parseInt;
int i10;
Resources resources;
this.f27232Y = jVar;
o();
Uri normalizeScheme = jVar.f27193a.normalizeScheme();
boolean equals = TextUtils.equals("rawresource", normalizeScheme.getScheme());
Context context = this.f27231X;
if (equals) {
resources = context.getResources();
List<String> pathSegments = normalizeScheme.getPathSegments();
if (pathSegments.size() != 1) {
throw new RawResourceDataSource$RawResourceDataSourceException("rawresource:// URI must have exactly one path element, found " + pathSegments.size(), null, 2000);
}
try {
i10 = Integer.parseInt(pathSegments.get(0));
} catch (NumberFormatException unused) {
throw new RawResourceDataSource$RawResourceDataSourceException("Resource identifier must be an integer.", null, 1004);
}
} else {
if (!TextUtils.equals("android.resource", normalizeScheme.getScheme())) {
throw new RawResourceDataSource$RawResourceDataSourceException("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 e10) {
throw new RawResourceDataSource$RawResourceDataSourceException("Package in android.resource:// URI not found. Check http://g.co/dev/packagevisibility.", e10, 2005);
}
}
if (path.matches("\\d+")) {
try {
parseInt = Integer.parseInt(path);
} catch (NumberFormatException unused2) {
throw new RawResourceDataSource$RawResourceDataSourceException("Resource identifier must be an integer.", null, 1004);
}
} else {
parseInt = resourcesForApplication.getIdentifier(AbstractC4227a.g(packageName, ":", path), "raw", null);
if (parseInt == 0) {
throw new RawResourceDataSource$RawResourceDataSourceException("Resource not found.", null, 2005);
}
}
i10 = parseInt;
resources = resourcesForApplication;
}
try {
AssetFileDescriptor openRawResourceFd = resources.openRawResourceFd(i10);
if (openRawResourceFd == null) {
throw new RawResourceDataSource$RawResourceDataSourceException("Resource is compressed: " + normalizeScheme, null, 2000);
}
this.f27233Z = openRawResourceFd;
long length = openRawResourceFd.getLength();
FileInputStream fileInputStream = new FileInputStream(this.f27233Z.getFileDescriptor());
this.f27234r0 = fileInputStream;
long j10 = jVar.f27197e;
try {
if (length != -1 && j10 > length) {
throw new RawResourceDataSource$RawResourceDataSourceException(null, null, 2008);
}
long startOffset = this.f27233Z.getStartOffset();
long skip = fileInputStream.skip(startOffset + j10) - startOffset;
if (skip != j10) {
throw new RawResourceDataSource$RawResourceDataSourceException(null, null, 2008);
}
if (length == -1) {
FileChannel channel = fileInputStream.getChannel();
if (channel.size() == 0) {
this.f27235s0 = -1L;
} else {
long size = channel.size() - channel.position();
this.f27235s0 = size;
if (size < 0) {
throw new RawResourceDataSource$RawResourceDataSourceException(null, null, 2008);
}
}
} else {
long j11 = length - skip;
this.f27235s0 = j11;
if (j11 < 0) {
throw new DataSourceException(2008);
}
}
long j12 = jVar.f27198f;
if (j12 != -1) {
long j13 = this.f27235s0;
this.f27235s0 = j13 == -1 ? j12 : Math.min(j13, j12);
}
this.f27236t0 = true;
p(jVar);
return j12 != -1 ? j12 : this.f27235s0;
} catch (RawResourceDataSource$RawResourceDataSourceException e11) {
throw e11;
} catch (IOException e12) {
throw new RawResourceDataSource$RawResourceDataSourceException(null, e12, 2000);
}
} catch (Resources.NotFoundException e13) {
throw new RawResourceDataSource$RawResourceDataSourceException(null, e13, 2005);
}
}
@Override
public final int n(byte[] bArr, int i10, int i11) {
if (i11 == 0) {
return 0;
}
long j10 = this.f27235s0;
if (j10 != 0) {
if (j10 != -1) {
try {
i11 = (int) Math.min(j10, i11);
} catch (IOException e10) {
throw new RawResourceDataSource$RawResourceDataSourceException(null, e10, 2000);
}
}
FileInputStream fileInputStream = this.f27234r0;
int i12 = y.f25148a;
int read = fileInputStream.read(bArr, i10, i11);
if (read != -1) {
long j11 = this.f27235s0;
if (j11 != -1) {
this.f27235s0 = j11 - read;
}
k(read);
return read;
}
if (this.f27235s0 != -1) {
throw new RawResourceDataSource$RawResourceDataSourceException("End of stream reached having not read sufficient data.", new EOFException(), 2000);
}
}
return -1;
}
}