正在查看: All File Recovery v1.0.2 应用的 o0.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: All File Recovery v1.0.2 应用的 o0.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package d2;
import X1.C0561b0;
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 java.io.EOFException;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.channels.FileChannel;
import java.util.List;
@a2.i0
public final class o0 extends AbstractC0985e {
@Deprecated
public static final String f23723l = "rawresource";
public final Context f23724f;
@Nullable
public C1003x f23725g;
@Nullable
public AssetFileDescriptor f23726h;
@Nullable
public InputStream f23727i;
public long f23728j;
public boolean f23729k;
public static class a extends C1000u {
@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 i4) {
super(str, th, i4);
}
}
public o0(Context context) {
super(false);
this.f23724f = context.getApplicationContext();
}
@Deprecated
public static Uri buildRawResourceUri(int i4) {
return Uri.parse("rawresource:///" + i4);
}
public static AssetFileDescriptor j(Context context, C1003x c1003x) throws a {
Resources resourcesForApplication;
int identifier;
Uri normalizeScheme = c1003x.f23779a.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 = k(pathSegments.get(0));
} else {
if (!TextUtils.equals(C1004y.f23807t, 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("/")) {
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 e4) {
throw new a("Package in android.resource:// URI not found. Check http://g.co/dev/packagevisibility.", e4, C0561b0.f8784B);
}
}
if (path.matches("\\d+")) {
identifier = k(path);
} else {
identifier = resourcesForApplication.getIdentifier(M.b.a(packageName, ":", path), "raw", null);
if (identifier == 0) {
throw new a("Resource not found.", null, C0561b0.f8784B);
}
}
}
try {
AssetFileDescriptor openRawResourceFd = resourcesForApplication.openRawResourceFd(identifier);
if (openRawResourceFd != null) {
return openRawResourceFd;
}
throw new a("Resource is compressed: " + normalizeScheme, null, 2000);
} catch (Resources.NotFoundException e5) {
throw new a(null, e5, C0561b0.f8784B);
}
}
public static int k(String str) throws a {
try {
return Integer.parseInt(str);
} catch (NumberFormatException unused) {
throw new a("Resource identifier must be an integer.", null, 1004);
}
}
@Override
public long a(C1003x c1003x) throws a {
this.f23725g = c1003x;
h(c1003x);
AssetFileDescriptor j4 = j(this.f23724f, c1003x);
this.f23726h = j4;
long length = j4.getLength();
FileInputStream fileInputStream = new FileInputStream(this.f23726h.getFileDescriptor());
this.f23727i = fileInputStream;
if (length != -1) {
try {
if (c1003x.f23785g > length) {
throw new a(null, null, 2008);
}
} catch (a e4) {
throw e4;
} catch (IOException e5) {
throw new a(null, e5, 2000);
}
}
long startOffset = this.f23726h.getStartOffset();
long skip = fileInputStream.skip(c1003x.f23785g + startOffset) - startOffset;
if (skip != c1003x.f23785g) {
throw new a(null, null, 2008);
}
if (length == -1) {
FileChannel channel = fileInputStream.getChannel();
if (channel.size() == 0) {
this.f23728j = -1L;
} else {
long size = channel.size() - channel.position();
this.f23728j = size;
if (size < 0) {
throw new a(null, null, 2008);
}
}
} else {
long j5 = length - skip;
this.f23728j = j5;
if (j5 < 0) {
throw new C1000u(2008);
}
}
long j7 = c1003x.f23786h;
if (j7 != -1) {
long j8 = this.f23728j;
if (j8 != -1) {
j7 = Math.min(j8, j7);
}
this.f23728j = j7;
}
this.f23729k = true;
i(c1003x);
long j9 = c1003x.f23786h;
return j9 != -1 ? j9 : this.f23728j;
}
@Override
public void close() throws a {
this.f23725g = null;
try {
try {
InputStream inputStream = this.f23727i;
if (inputStream != null) {
inputStream.close();
}
this.f23727i = null;
try {
try {
AssetFileDescriptor assetFileDescriptor = this.f23726h;
if (assetFileDescriptor != null) {
assetFileDescriptor.close();
}
} catch (IOException e4) {
throw new a(null, e4, 2000);
}
} finally {
this.f23726h = null;
if (this.f23729k) {
this.f23729k = false;
g();
}
}
} catch (IOException e5) {
throw new a(null, e5, 2000);
}
} catch (Throwable th) {
this.f23727i = null;
try {
try {
AssetFileDescriptor assetFileDescriptor2 = this.f23726h;
if (assetFileDescriptor2 != null) {
assetFileDescriptor2.close();
}
this.f23726h = null;
if (this.f23729k) {
this.f23729k = false;
g();
}
throw th;
} catch (IOException e7) {
throw new a(null, e7, 2000);
}
} finally {
this.f23726h = null;
if (this.f23729k) {
this.f23729k = false;
g();
}
}
}
}
@Override
@Nullable
public Uri getUri() {
C1003x c1003x = this.f23725g;
if (c1003x != null) {
return c1003x.f23779a;
}
return null;
}
@Override
public int read(byte[] bArr, int i4, int i5) throws a {
if (i5 == 0) {
return 0;
}
long j4 = this.f23728j;
if (j4 == 0) {
return -1;
}
if (j4 != -1) {
try {
i5 = (int) Math.min(j4, i5);
} catch (IOException e4) {
throw new a(null, e4, 2000);
}
}
InputStream inputStream = this.f23727i;
a2.u0.o(inputStream);
int read = inputStream.read(bArr, i4, i5);
if (read == -1) {
if (this.f23728j == -1) {
return -1;
}
throw new a("End of stream reached having not read sufficient data.", new EOFException(), 2000);
}
long j5 = this.f23728j;
if (j5 != -1) {
this.f23728j = j5 - read;
}
f(read);
return read;
}
}