正在查看: Namma Yatri v3.3.7 应用的 z.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Namma Yatri v3.3.7 应用的 z.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package D0;
import A0.AbstractC0366a;
import A0.N;
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;
public final class z extends AbstractC0407b {
private final Context f863e;
private k f864f;
private AssetFileDescriptor f865g;
private InputStream f866h;
private long f867i;
private boolean f868j;
public static class a extends h {
public a(String str) {
super(str, null, 2000);
}
public a(String str, Throwable th, int i7) {
super(str, th, i7);
}
}
public z(Context context) {
super(false);
this.f863e = context.getApplicationContext();
}
@Deprecated
public static Uri buildRawResourceUri(int i7) {
return Uri.parse("rawresource:///" + i7);
}
private static AssetFileDescriptor t(Context context, k kVar) {
Resources resourcesForApplication;
int identifier;
Uri normalizeScheme = kVar.f784a.normalizeScheme();
if (TextUtils.equals("rawresource", 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());
}
identifier = u(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) AbstractC0366a.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())) {
resourcesForApplication = context.getResources();
} else {
try {
resourcesForApplication = context.getPackageManager().getResourcesForApplication(packageName);
} catch (PackageManager.NameNotFoundException e7) {
throw new a("Package in android.resource:// URI not found. Check http://g.co/dev/packagevisibility.", e7, 2005);
}
}
if (str.matches("\\d+")) {
identifier = u(str);
} else {
identifier = resourcesForApplication.getIdentifier(packageName + ":" + str, "raw", null);
if (identifier == 0) {
throw new a("Resource not found.", null, 2005);
}
}
}
try {
AssetFileDescriptor openRawResourceFd = resourcesForApplication.openRawResourceFd(identifier);
if (openRawResourceFd != null) {
return openRawResourceFd;
}
throw new a("Resource is compressed: " + normalizeScheme, null, 2000);
} catch (Resources.NotFoundException e8) {
throw new a(null, e8, 2005);
}
}
private static int u(String str) {
try {
return Integer.parseInt(str);
} catch (NumberFormatException unused) {
throw new a("Resource identifier must be an integer.", null, 1004);
}
}
@Override
public void close() {
this.f864f = null;
try {
try {
InputStream inputStream = this.f866h;
if (inputStream != null) {
inputStream.close();
}
this.f866h = null;
try {
try {
AssetFileDescriptor assetFileDescriptor = this.f865g;
if (assetFileDescriptor != null) {
assetFileDescriptor.close();
}
} catch (IOException e7) {
throw new a(null, e7, 2000);
}
} finally {
this.f865g = null;
if (this.f868j) {
this.f868j = false;
q();
}
}
} catch (IOException e8) {
throw new a(null, e8, 2000);
}
} catch (Throwable th) {
this.f866h = null;
try {
try {
AssetFileDescriptor assetFileDescriptor2 = this.f865g;
if (assetFileDescriptor2 != null) {
assetFileDescriptor2.close();
}
this.f865g = null;
if (this.f868j) {
this.f868j = false;
q();
}
throw th;
} catch (IOException e9) {
throw new a(null, e9, 2000);
}
} finally {
this.f865g = null;
if (this.f868j) {
this.f868j = false;
q();
}
}
}
}
@Override
public long l(k kVar) {
this.f864f = kVar;
r(kVar);
AssetFileDescriptor t7 = t(this.f863e, kVar);
this.f865g = t7;
long length = t7.getLength();
FileInputStream fileInputStream = new FileInputStream(this.f865g.getFileDescriptor());
this.f866h = fileInputStream;
if (length != -1) {
try {
if (kVar.f790g > length) {
throw new a(null, null, 2008);
}
} catch (a e7) {
throw e7;
} catch (IOException e8) {
throw new a(null, e8, 2000);
}
}
long startOffset = this.f865g.getStartOffset();
long skip = fileInputStream.skip(kVar.f790g + startOffset) - startOffset;
if (skip != kVar.f790g) {
throw new a(null, null, 2008);
}
if (length == -1) {
FileChannel channel = fileInputStream.getChannel();
if (channel.size() == 0) {
this.f867i = -1L;
} else {
long size = channel.size() - channel.position();
this.f867i = size;
if (size < 0) {
throw new a(null, null, 2008);
}
}
} else {
long j7 = length - skip;
this.f867i = j7;
if (j7 < 0) {
throw new h(2008);
}
}
long j8 = kVar.f791h;
if (j8 != -1) {
long j9 = this.f867i;
if (j9 != -1) {
j8 = Math.min(j9, j8);
}
this.f867i = j8;
}
this.f868j = true;
s(kVar);
long j10 = kVar.f791h;
return j10 != -1 ? j10 : this.f867i;
}
@Override
public Uri n() {
k kVar = this.f864f;
if (kVar != null) {
return kVar.f784a;
}
return null;
}
@Override
public int read(byte[] bArr, int i7, int i8) {
if (i8 == 0) {
return 0;
}
long j7 = this.f867i;
if (j7 == 0) {
return -1;
}
if (j7 != -1) {
try {
i8 = (int) Math.min(j7, i8);
} catch (IOException e7) {
throw new a(null, e7, 2000);
}
}
int read = ((InputStream) N.i(this.f866h)).read(bArr, i7, i8);
if (read == -1) {
if (this.f867i == -1) {
return -1;
}
throw new a("End of stream reached having not read sufficient data.", new EOFException(), 2000);
}
long j8 = this.f867i;
if (j8 != -1) {
this.f867i = j8 - read;
}
p(read);
return read;
}
}