正在查看: Aplazo v2.4.68 应用的 C3460w.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Aplazo v2.4.68 应用的 C3460w.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package y2;
import A2.AbstractC0007g;
import S.AbstractC0473a;
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 com.adjust.sdk.network.ErrorCodes;
import java.io.EOFException;
import java.io.FileInputStream;
import java.io.IOException;
import java.nio.channels.FileChannel;
import java.util.List;
public final class C3460w extends AbstractC3440c {
public final Context f34424g;
public C3448k f34425h;
public AssetFileDescriptor f34426i;
public FileInputStream f34427j;
public long k;
public boolean f34428l;
public C3460w(Context context) {
super(false);
this.f34424g = context.getApplicationContext();
}
@Deprecated
public static Uri buildRawResourceUri(int i10) {
return Uri.parse("rawresource:///" + i10);
}
@Override
public final long C(C3448k c3448k) {
Resources resourcesForApplication;
int parseInt;
int i10;
Resources resources;
this.f34425h = c3448k;
h();
Uri normalizeScheme = c3448k.f34387a.normalizeScheme();
boolean equals = TextUtils.equals("rawresource", normalizeScheme.getScheme());
Context context = this.f34424g;
if (equals) {
resources = context.getResources();
List<String> pathSegments = normalizeScheme.getPathSegments();
if (pathSegments.size() != 1) {
throw new C3459v(2000, null, "rawresource:// URI must have exactly one path element, found " + pathSegments.size());
}
try {
i10 = Integer.parseInt(pathSegments.get(0));
} catch (NumberFormatException unused) {
throw new C3459v(ErrorCodes.PROTOCOL_EXCEPTION, null, "Resource identifier must be an integer.");
}
} else {
if (!TextUtils.equals("android.resource", normalizeScheme.getScheme())) {
throw new C3459v(ErrorCodes.PROTOCOL_EXCEPTION, null, "Unsupported URI scheme (" + normalizeScheme.getScheme() + "). Only android.resource is supported.");
}
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 C3459v(2005, e10, "Package in android.resource:// URI not found. Check http://g.co/dev/packagevisibility.");
}
}
if (path.matches("\\d+")) {
try {
parseInt = Integer.parseInt(path);
} catch (NumberFormatException unused2) {
throw new C3459v(ErrorCodes.PROTOCOL_EXCEPTION, null, "Resource identifier must be an integer.");
}
} else {
parseInt = resourcesForApplication.getIdentifier(AbstractC0007g.j(packageName, ":", path), "raw", null);
if (parseInt == 0) {
throw new C3459v(2005, null, "Resource not found.");
}
}
i10 = parseInt;
resources = resourcesForApplication;
}
try {
AssetFileDescriptor openRawResourceFd = resources.openRawResourceFd(i10);
if (openRawResourceFd == null) {
throw new C3459v(2000, null, AbstractC0473a.h(normalizeScheme, "Resource is compressed: "));
}
this.f34426i = openRawResourceFd;
long length = openRawResourceFd.getLength();
FileInputStream fileInputStream = new FileInputStream(this.f34426i.getFileDescriptor());
this.f34427j = fileInputStream;
long j10 = c3448k.f34391e;
try {
if (length != -1 && j10 > length) {
throw new C3459v(2008, null, null);
}
long startOffset = this.f34426i.getStartOffset();
long skip = fileInputStream.skip(startOffset + j10) - startOffset;
if (skip != j10) {
throw new C3459v(2008, null, null);
}
if (length == -1) {
FileChannel channel = fileInputStream.getChannel();
if (channel.size() == 0) {
this.k = -1L;
} else {
long size = channel.size() - channel.position();
this.k = size;
if (size < 0) {
throw new C3459v(2008, null, null);
}
}
} else {
long j11 = length - skip;
this.k = j11;
if (j11 < 0) {
throw new C3446i(2008);
}
}
long j12 = c3448k.f34392f;
if (j12 != -1) {
long j13 = this.k;
this.k = j13 == -1 ? j12 : Math.min(j13, j12);
}
this.f34428l = true;
i(c3448k);
return j12 != -1 ? j12 : this.k;
} catch (C3459v e11) {
throw e11;
} catch (IOException e12) {
throw new C3459v(2000, e12, null);
}
} catch (Resources.NotFoundException e13) {
throw new C3459v(2005, e13, null);
}
}
@Override
public final void close() {
this.f34425h = null;
try {
try {
FileInputStream fileInputStream = this.f34427j;
if (fileInputStream != null) {
fileInputStream.close();
}
this.f34427j = null;
try {
try {
AssetFileDescriptor assetFileDescriptor = this.f34426i;
if (assetFileDescriptor != null) {
assetFileDescriptor.close();
}
} catch (IOException e10) {
throw new C3459v(2000, e10, null);
}
} finally {
this.f34426i = null;
if (this.f34428l) {
this.f34428l = false;
e();
}
}
} catch (IOException e11) {
throw new C3459v(2000, e11, null);
}
} catch (Throwable th) {
this.f34427j = null;
try {
try {
AssetFileDescriptor assetFileDescriptor2 = this.f34426i;
if (assetFileDescriptor2 != null) {
assetFileDescriptor2.close();
}
this.f34426i = null;
if (this.f34428l) {
this.f34428l = false;
e();
}
throw th;
} catch (IOException e12) {
throw new C3459v(2000, e12, null);
}
} finally {
this.f34426i = null;
if (this.f34428l) {
this.f34428l = false;
e();
}
}
}
}
@Override
public final int read(byte[] bArr, int i10, int i11) {
if (i11 == 0) {
return 0;
}
long j10 = this.k;
if (j10 == 0) {
return -1;
}
if (j10 != -1) {
try {
i11 = (int) Math.min(j10, i11);
} catch (IOException e10) {
throw new C3459v(2000, e10, null);
}
}
FileInputStream fileInputStream = this.f34427j;
int i12 = w2.r.f33460a;
int read = fileInputStream.read(bArr, i10, i11);
if (read == -1) {
if (this.k == -1) {
return -1;
}
throw new C3459v(2000, new EOFException(), "End of stream reached having not read sufficient data.");
}
long j11 = this.k;
if (j11 != -1) {
this.k = j11 - read;
}
b(read);
return read;
}
@Override
public final Uri y() {
C3448k c3448k = this.f34425h;
if (c3448k != null) {
return c3448k.f34387a;
}
return null;
}
}