导航菜单

页面标题

页面副标题

Pulsar v1.0.0 - f.java 源代码

正在查看: Pulsar v1.0.0 应用的 f.java JAVA 源代码文件

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


package com.ReactNativeBlobUtil;

import android.content.res.AssetFileDescriptor;
import android.media.MediaScannerConnection;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Environment;
import android.os.StatFs;
import com.ReactNativeBlobUtil.g;
import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.Callback;
import com.facebook.react.bridge.Promise;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.WritableArray;
import com.facebook.react.bridge.WritableMap;
import com.facebook.react.modules.core.DeviceEventManagerModule;
import com.facebook.react.uimanager.events.PointerEventHelper;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.security.MessageDigest;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

class f {

    private ReactApplicationContext f12771a;

    private DeviceEventManagerModule.RCTDeviceEventEmitter f12772b;

    class a extends AsyncTask<String, Integer, Integer> {

        final Callback f12773a;

        a(Callback callback) {
            this.f12773a = callback;
        }

        @Override
        public Integer doInBackground(String... strArr) {
            WritableArray createArray = Arguments.createArray();
            if (strArr[0] == null) {
                this.f12773a.invoke("the path specified for lstat is either `null` or `undefined`.");
                return 0;
            }
            File file = new File(strArr[0]);
            if (!file.exists()) {
                this.f12773a.invoke("failed to lstat path `" + strArr[0] + "` because it does not exist or it is not a folder");
                return 0;
            }
            if (file.isDirectory()) {
                for (String str : file.list()) {
                    createArray.pushMap(f.z(file.getPath() + "/" + str));
                }
            } else {
                createArray.pushMap(f.z(file.getAbsolutePath()));
            }
            this.f12773a.invoke(null, createArray);
            return 0;
        }
    }

    class b implements MediaScannerConnection.OnScanCompletedListener {

        final Callback f12774a;

        b(Callback callback) {
            this.f12774a = callback;
        }

        @Override
        public void onScanCompleted(String str, Uri uri) {
            this.f12774a.invoke(null, Boolean.TRUE);
        }
    }

    class c extends AsyncTask<ReadableArray, Integer, Integer> {

        final Callback f12776a;

        c(Callback callback) {
            this.f12776a = callback;
        }

        @Override
        public Integer doInBackground(ReadableArray... readableArrayArr) {
            try {
                ArrayList arrayList = new ArrayList();
                for (int i5 = 0; i5 < readableArrayArr[0].size(); i5++) {
                    String string = readableArrayArr[0].getString(i5);
                    File file = new File(string);
                    if (file.exists() && !file.delete()) {
                        arrayList.add(string);
                    }
                }
                if (arrayList.isEmpty()) {
                    this.f12776a.invoke(null, Boolean.TRUE);
                } else {
                    StringBuilder sb = new StringBuilder();
                    sb.append("Failed to delete: ");
                    Iterator it = arrayList.iterator();
                    while (it.hasNext()) {
                        sb.append((String) it.next());
                        sb.append(", ");
                    }
                    this.f12776a.invoke(sb.toString());
                }
            } catch (Exception e5) {
                this.f12776a.invoke(e5.getLocalizedMessage());
            }
            return Integer.valueOf(readableArrayArr[0].size());
        }
    }

    f(ReactApplicationContext reactApplicationContext) {
        this.f12771a = reactApplicationContext;
        this.f12772b = (DeviceEventManagerModule.RCTDeviceEventEmitter) reactApplicationContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class);
    }

    static void A(String str, Callback callback) {
        try {
            d(new File(p.normalizePath(str)));
            callback.invoke(null, Boolean.TRUE);
        } catch (Exception e5) {
            callback.invoke(e5.getLocalizedMessage(), Boolean.FALSE);
        }
    }

    static void B(String str, ReadableArray readableArray, boolean z4, Promise promise) {
        try {
            File file = new File(str);
            File parentFile = file.getParentFile();
            if (!file.exists()) {
                if (parentFile != null && !parentFile.exists() && !parentFile.mkdirs() && !parentFile.exists()) {
                    promise.reject("ENOTDIR", "Failed to create parent directory of '" + str + "'");
                    return;
                }
                if (!file.createNewFile()) {
                    promise.reject("ENOENT", "File '" + str + "' does not exist and could not be created");
                    return;
                }
            }
            FileOutputStream fileOutputStream = new FileOutputStream(file, z4);
            try {
                byte[] bArr = new byte[readableArray.size()];
                for (int i5 = 0; i5 < readableArray.size(); i5++) {
                    bArr[i5] = (byte) readableArray.getInt(i5);
                }
                fileOutputStream.write(bArr);
                fileOutputStream.close();
                promise.resolve(Integer.valueOf(readableArray.size()));
            } catch (Throwable th) {
                fileOutputStream.close();
                throw th;
            }
        } catch (FileNotFoundException unused) {
            promise.reject("ENOENT", "File '" + str + "' does not exist and could not be created");
        } catch (Exception e5) {
            promise.reject("EUNSPECIFIED", e5.getLocalizedMessage());
        }
    }

    static void C(String str, String str2, String str3, boolean z4, boolean z5, Promise promise) {
        FileOutputStream fileOutputStream;
        int length;
        try {
            File file = new File(str);
            File parentFile = file.getParentFile();
            if (!file.exists()) {
                if (parentFile != null && !parentFile.exists() && !parentFile.mkdirs() && !parentFile.exists()) {
                    promise.reject("EUNSPECIFIED", "Failed to create parent directory of '" + str + "'");
                    return;
                }
                if (!file.createNewFile()) {
                    promise.reject("ENOENT", "File '" + str + "' does not exist and could not be created");
                    return;
                }
            }
            if (str2.equalsIgnoreCase(e.f12766j)) {
                String normalizePath = p.normalizePath(str3);
                File file2 = new File(normalizePath);
                if (!file2.exists()) {
                    promise.reject("ENOENT", "No such file '" + str + "' ('" + normalizePath + "')");
                    return;
                }
                byte[] bArr = new byte[10240];
                FileInputStream fileInputStream = null;
                try {
                    FileInputStream fileInputStream2 = new FileInputStream(file2);
                    try {
                        fileOutputStream = new FileOutputStream(file, z5);
                        length = 0;
                        while (true) {
                            try {
                                int read = fileInputStream2.read(bArr);
                                if (read <= 0) {
                                    break;
                                }
                                fileOutputStream.write(bArr, 0, read);
                                length += read;
                            } catch (Throwable th) {
                                th = th;
                                fileInputStream = fileInputStream2;
                                if (fileInputStream != null) {
                                    fileInputStream.close();
                                }
                                if (fileOutputStream != null) {
                                }
                                throw th;
                            }
                        }
                        fileInputStream2.close();
                    } catch (Throwable th2) {
                        th = th2;
                        fileOutputStream = null;
                    }
                } catch (Throwable th3) {
                    th = th3;
                    fileOutputStream = null;
                }
            } else {
                byte[] stringToBytes = p.stringToBytes(str3, str2);
                if (z4) {
                    g.a aVar = g.f12777a;
                    if (aVar == null) {
                        throw new IllegalStateException("Write file with transform was specified but the shared file transformer is not set");
                    }
                    stringToBytes = aVar.onWriteFile(stringToBytes);
                }
                fileOutputStream = new FileOutputStream(file, z5);
                try {
                    fileOutputStream.write(stringToBytes);
                    length = stringToBytes.length;
                } finally {
                    fileOutputStream.close();
                }
            }
            fileOutputStream.close();
            promise.resolve(Integer.valueOf(length));
        } catch (FileNotFoundException unused) {
            promise.reject("ENOENT", "File '" + str + "' does not exist and could not be created, or it is a directory");
        } catch (Exception e5) {
            promise.reject("EUNSPECIFIED", e5.getLocalizedMessage());
        }
    }

    static boolean D(String str, String str2, String str3, boolean z4) {
        FileOutputStream fileOutputStream;
        try {
            File file = new File(p.normalizePath(str));
            File parentFile = file.getParentFile();
            if (!file.exists() && ((parentFile != null && !parentFile.exists() && !parentFile.mkdirs() && !parentFile.exists()) || !file.createNewFile())) {
                return false;
            }
            if (str2.equalsIgnoreCase(e.f12766j)) {
                File file2 = new File(p.normalizePath(str3));
                if (!file2.exists()) {
                    return false;
                }
                byte[] bArr = new byte[10240];
                FileInputStream fileInputStream = null;
                try {
                    FileInputStream fileInputStream2 = new FileInputStream(file2);
                    try {
                        fileOutputStream = new FileOutputStream(file, z4);
                        while (true) {
                            try {
                                int read = fileInputStream2.read(bArr);
                                if (read <= 0) {
                                    break;
                                }
                                fileOutputStream.write(bArr, 0, read);
                            } catch (Throwable th) {
                                th = th;
                                fileInputStream = fileInputStream2;
                                if (fileInputStream != null) {
                                    fileInputStream.close();
                                }
                                if (fileOutputStream != null) {
                                }
                                throw th;
                            }
                        }
                        fileInputStream2.close();
                    } catch (Throwable th2) {
                        th = th2;
                        fileOutputStream = null;
                    }
                } catch (Throwable th3) {
                    th = th3;
                    fileOutputStream = null;
                }
            } else {
                byte[] stringToBytes = p.stringToBytes(str3, str2);
                fileOutputStream = new FileOutputStream(file, z4);
                try {
                    fileOutputStream.write(stringToBytes);
                    int length = stringToBytes.length;
                } finally {
                    fileOutputStream.close();
                }
            }
            fileOutputStream.close();
            return true;
        } catch (FileNotFoundException | Exception unused) {
            return false;
        }
    }

    static void a(java.lang.String r8, java.lang.String r9, com.facebook.react.bridge.Callback r10) {
        throw new UnsupportedOperationException("Method not decompiled: com.ReactNativeBlobUtil.f.a(java.lang.String, java.lang.String, com.facebook.react.bridge.Callback):void");
    }

    static void b(String str, String str2, String str3, Promise promise) {
        try {
            String normalizePath = p.normalizePath(str);
            File file = new File(normalizePath);
            boolean createNewFile = file.createNewFile();
            if (str3.equals(e.f12766j)) {
                File file2 = new File(str2.replace(e.f12762f, PointerEventHelper.POINTER_TYPE_UNKNOWN));
                if (!file2.exists()) {
                    promise.reject("ENOENT", "Source file : " + str2 + " does not exist");
                    return;
                }
                FileInputStream fileInputStream = new FileInputStream(file2);
                FileOutputStream fileOutputStream = new FileOutputStream(file);
                byte[] bArr = new byte[10240];
                while (true) {
                    int read = fileInputStream.read(bArr);
                    if (read <= 0) {
                        break;
                    } else {
                        fileOutputStream.write(bArr, 0, read);
                    }
                }
                fileInputStream.close();
                fileOutputStream.close();
            } else {
                if (!createNewFile) {
                    promise.reject("EEXIST", "File `" + normalizePath + "` already exists");
                    return;
                }
                new FileOutputStream(file).write(p.stringToBytes(str2, str3));
            }
            promise.resolve(normalizePath);
        } catch (Exception e5) {
            promise.reject("EUNSPECIFIED", e5.getLocalizedMessage());
        }
    }

    static void c(String str, ReadableArray readableArray, Promise promise) {
        try {
            String normalizePath = p.normalizePath(str);
            File file = new File(normalizePath);
            if (!file.createNewFile()) {
                promise.reject("EEXIST", "File at path `" + normalizePath + "` already exists");
                return;
            }
            FileOutputStream fileOutputStream = new FileOutputStream(file);
            byte[] bArr = new byte[readableArray.size()];
            for (int i5 = 0; i5 < readableArray.size(); i5++) {
                bArr[i5] = (byte) readableArray.getInt(i5);
            }
            fileOutputStream.write(bArr);
            promise.resolve(normalizePath);
        } catch (Exception e5) {
            promise.reject("EUNSPECIFIED", e5.getLocalizedMessage());
        }
    }

    private static void d(File file) throws IOException {
        if (file.isDirectory()) {
            File[] listFiles = file.listFiles();
            if (listFiles == null) {
                throw new NullPointerException("Received null trying to list files of directory '" + file + "'");
            }
            for (File file2 : listFiles) {
                d(file2);
            }
        }
        if (file.delete()) {
            return;
        }
        throw new IOException("Failed to delete '" + file + "'");
    }

    static void e(Callback callback, ReactApplicationContext reactApplicationContext) {
        String str;
        StatFs statFs = new StatFs(reactApplicationContext.getFilesDir().getPath());
        WritableMap createMap = Arguments.createMap();
        createMap.putString("internal_free", String.valueOf(statFs.getFreeBytes()));
        createMap.putString("internal_total", String.valueOf(statFs.getTotalBytes()));
        File externalFilesDir = reactApplicationContext.getExternalFilesDir(null);
        if (externalFilesDir != null) {
            StatFs statFs2 = new StatFs(externalFilesDir.getPath());
            createMap.putString("external_free", String.valueOf(statFs2.getFreeBytes()));
            str = String.valueOf(statFs2.getTotalBytes());
        } else {
            str = "-1";
            createMap.putString("external_free", "-1");
        }
        createMap.putString("external_total", str);
        callback.invoke(null, createMap);
    }

    static void f(String str, Callback callback) {
        if (o(str)) {
            try {
                h.f12779c.getAssets().openFd(str.replace(e.f12764h, PointerEventHelper.POINTER_TYPE_UNKNOWN));
                callback.invoke(Boolean.TRUE, Boolean.FALSE);
                return;
            } catch (IOException unused) {
                Boolean bool = Boolean.FALSE;
                callback.invoke(bool, bool);
                return;
            }
        }
        String normalizePath = p.normalizePath(str);
        if (normalizePath != null) {
            callback.invoke(Boolean.valueOf(new File(normalizePath).exists()), Boolean.valueOf(new File(normalizePath).isDirectory()));
        } else {
            Boolean bool2 = Boolean.FALSE;
            callback.invoke(bool2, bool2);
        }
    }

    static String g(ReactApplicationContext reactApplicationContext) {
        File cacheDir = reactApplicationContext.getCacheDir();
        return cacheDir != null ? cacheDir.getAbsolutePath() : PointerEventHelper.POINTER_TYPE_UNKNOWN;
    }

    public static void getSDCardApplicationDir(ReactApplicationContext reactApplicationContext, Promise promise) {
        String str;
        if (Environment.getExternalStorageState().equals("mounted")) {
            try {
                promise.resolve(reactApplicationContext.getExternalFilesDir(null).getParentFile().getAbsolutePath());
                return;
            } catch (Exception e5) {
                str = e5.getLocalizedMessage();
            }
        } else {
            str = "External storage not mounted";
        }
        promise.reject("ReactNativeBlobUtil.getSDCardApplicationDir", str);
    }

    public static void getSDCardDir(ReactApplicationContext reactApplicationContext, Promise promise) {
        String str;
        if (Environment.getExternalStorageState().equals("mounted")) {
            try {
                promise.resolve(reactApplicationContext.getExternalFilesDir(null).getAbsolutePath());
                return;
            } catch (Exception e5) {
                str = e5.getLocalizedMessage();
            }
        } else {
            str = "External storage not mounted";
        }
        promise.reject("ReactNativeBlobUtil.getSDCardDir", str);
    }

    static String h(ReactApplicationContext reactApplicationContext, String str) {
        File externalFilesDir = reactApplicationContext.getExternalFilesDir(str);
        return externalFilesDir != null ? externalFilesDir.getAbsolutePath() : PointerEventHelper.POINTER_TYPE_UNKNOWN;
    }

    static String i(ReactApplicationContext reactApplicationContext) {
        File filesDir = reactApplicationContext.getFilesDir();
        return filesDir != null ? filesDir.getAbsolutePath() : PointerEventHelper.POINTER_TYPE_UNKNOWN;
    }

    static Map<String, Object> j(ReactApplicationContext reactApplicationContext) {
        HashMap hashMap = new HashMap();
        hashMap.put("LegacyDCIMDir", Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM).getAbsolutePath());
        hashMap.put("LegacyPictureDir", Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).getAbsolutePath());
        hashMap.put("LegacyMusicDir", Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MUSIC).getAbsolutePath());
        hashMap.put("LegacyDownloadDir", Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath());
        hashMap.put("LegacyMovieDir", Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES).getAbsolutePath());
        hashMap.put("LegacyRingtoneDir", Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_RINGTONES).getAbsolutePath());
        hashMap.put("LegacySDCardDir", Environment.getExternalStorageState().equals("mounted") ? Environment.getExternalStorageDirectory().getAbsolutePath() : PointerEventHelper.POINTER_TYPE_UNKNOWN);
        return hashMap;
    }

    static Map<String, Object> k(ReactApplicationContext reactApplicationContext) {
        HashMap hashMap = new HashMap();
        hashMap.put("DocumentDir", i(reactApplicationContext));
        hashMap.put("CacheDir", g(reactApplicationContext));
        hashMap.put("DCIMDir", h(reactApplicationContext, Environment.DIRECTORY_DCIM));
        hashMap.put("PictureDir", h(reactApplicationContext, Environment.DIRECTORY_PICTURES));
        hashMap.put("MusicDir", h(reactApplicationContext, Environment.DIRECTORY_MUSIC));
        hashMap.put("DownloadDir", h(reactApplicationContext, Environment.DIRECTORY_DOWNLOADS));
        hashMap.put("MovieDir", h(reactApplicationContext, Environment.DIRECTORY_MOVIES));
        hashMap.put("RingtoneDir", h(reactApplicationContext, Environment.DIRECTORY_RINGTONES));
        if (Environment.getExternalStorageState().equals("mounted")) {
            hashMap.put("SDCardDir", h(reactApplicationContext, null));
            File externalFilesDir = reactApplicationContext.getExternalFilesDir(null);
            if (externalFilesDir != null && externalFilesDir.getParentFile() != null) {
                hashMap.put("SDCardApplicationDir", externalFilesDir.getParentFile().getAbsolutePath());
                hashMap.put("MainBundleDir", reactApplicationContext.getApplicationInfo().dataDir);
                hashMap.put("LibraryDir", PointerEventHelper.POINTER_TYPE_UNKNOWN);
                hashMap.put("ApplicationSupportDir", PointerEventHelper.POINTER_TYPE_UNKNOWN);
                return hashMap;
            }
        } else {
            hashMap.put("SDCardDir", PointerEventHelper.POINTER_TYPE_UNKNOWN);
        }
        hashMap.put("SDCardApplicationDir", PointerEventHelper.POINTER_TYPE_UNKNOWN);
        hashMap.put("MainBundleDir", reactApplicationContext.getApplicationInfo().dataDir);
        hashMap.put("LibraryDir", PointerEventHelper.POINTER_TYPE_UNKNOWN);
        hashMap.put("ApplicationSupportDir", PointerEventHelper.POINTER_TYPE_UNKNOWN);
        return hashMap;
    }

    static String l(String str) {
        return h.f12779c.getFilesDir() + "/ReactNativeBlobUtilTmp_" + str;
    }

    static void m(String str, String str2, Promise promise) {
        try {
            HashMap hashMap = new HashMap();
            hashMap.put("md5", "MD5");
            hashMap.put("sha1", "SHA-1");
            hashMap.put("sha224", "SHA-224");
            hashMap.put("sha256", "SHA-256");
            hashMap.put("sha384", "SHA-384");
            hashMap.put("sha512", "SHA-512");
            if (!hashMap.containsKey(str2)) {
                promise.reject("EINVAL", "Invalid algorithm '" + str2 + "', must be one of md5, sha1, sha224, sha256, sha384, sha512");
                return;
            }
            if (!str.startsWith(e.f12765i) && new File(p.normalizePath(str)).isDirectory()) {
                promise.reject("EISDIR", "Expecting a file but '" + str + "' is a directory");
                return;
            }
            MessageDigest messageDigest = MessageDigest.getInstance((String) hashMap.get(str2));
            InputStream n5 = n(str);
            if (n5 == null) {
                promise.reject("ENOENT", "No such file '" + str + "'");
                return;
            }
            byte[] bArr = new byte[1048576];
            while (true) {
                int read = n5.read(bArr);
                if (read == -1) {
                    break;
                } else {
                    messageDigest.update(bArr, 0, read);
                }
            }
            StringBuilder sb = new StringBuilder();
            for (byte b5 : messageDigest.digest()) {
                sb.append(String.format("%02x", Byte.valueOf(b5)));
            }
            promise.resolve(sb.toString());
        } catch (Exception e5) {
            e5.printStackTrace();
            promise.reject("EUNSPECIFIED", e5.getLocalizedMessage());
        }
    }

    private static InputStream n(String str) throws IOException {
        return str.startsWith(e.f12764h) ? h.f12779c.getAssets().open(str.replace(e.f12764h, PointerEventHelper.POINTER_TYPE_UNKNOWN)) : str.startsWith(e.f12765i) ? h.f12779c.getContentResolver().openInputStream(Uri.parse(str)) : new FileInputStream(new File(p.normalizePath(str)));
    }

    static boolean o(String str) {
        return str != null && str.startsWith(e.f12764h);
    }

    private static boolean p(String str) {
        if (!str.startsWith(e.f12764h)) {
            return new File(str).exists();
        }
        try {
            h.f12779c.getAssets().open(str.replace(e.f12764h, PointerEventHelper.POINTER_TYPE_UNKNOWN));
            return true;
        } catch (IOException unused) {
            return false;
        }
    }

    static void q(String str, Promise promise) {
        try {
            String normalizePath = p.normalizePath(str);
            File file = new File(normalizePath);
            if (!file.exists()) {
                promise.reject("ENOENT", "No such file '" + normalizePath + "'");
                return;
            }
            if (!file.isDirectory()) {
                promise.reject("ENOTDIR", "Not a directory '" + normalizePath + "'");
                return;
            }
            String[] list = new File(normalizePath).list();
            WritableArray createArray = Arguments.createArray();
            for (String str2 : list) {
                createArray.pushString(str2);
            }
            promise.resolve(createArray);
        } catch (Exception e5) {
            e5.printStackTrace();
            promise.reject("EUNSPECIFIED", e5.getLocalizedMessage());
        }
    }

    static void r(String str, Callback callback) {
        new a(callback).execute(p.normalizePath(str));
    }

    static void s(String str, Promise promise) {
        String normalizePath = p.normalizePath(str);
        File file = new File(normalizePath);
        if (file.exists()) {
            StringBuilder sb = new StringBuilder();
            sb.append(file.isDirectory() ? "Folder" : "File");
            sb.append(" '");
            sb.append(normalizePath);
            sb.append("' already exists");
            promise.reject("EEXIST", sb.toString());
            return;
        }
        try {
            if (file.mkdirs()) {
                promise.resolve(Boolean.TRUE);
                return;
            }
            promise.reject("EUNSPECIFIED", "mkdir failed to create some or all directories in '" + normalizePath + "'");
        } catch (Exception e5) {
            promise.reject("EUNSPECIFIED", e5.getLocalizedMessage());
        }
    }

    static void t(String str, String str2, Callback callback) {
        String normalizePath = p.normalizePath(str);
        String normalizePath2 = p.normalizePath(str2);
        File file = new File(normalizePath);
        if (!file.exists()) {
            callback.invoke("Source file at path `" + normalizePath + "` does not exist");
            return;
        }
        try {
            File file2 = new File(normalizePath2);
            File parentFile = file2.getParentFile();
            if (parentFile != null && !parentFile.exists()) {
                callback.invoke("mv failed because the destination directory doesn't exist");
                return;
            }
            if (file2.exists()) {
                file2.delete();
            }
            if (file.renameTo(file2)) {
                callback.invoke(new Object[0]);
            } else {
                callback.invoke("mv failed for unknown reasons");
            }
        } catch (Exception e5) {
            callback.invoke(e5.toString());
        }
    }

    static void u(java.lang.String r6, java.lang.String r7, boolean r8, com.facebook.react.bridge.Promise r9) {
        throw new UnsupportedOperationException("Method not decompiled: com.ReactNativeBlobUtil.f.u(java.lang.String, java.lang.String, boolean, com.facebook.react.bridge.Promise):void");
    }

    static void v(ReadableArray readableArray, Callback callback) {
        new c(callback).execute(readableArray);
    }

    static void x(String str, String str2, long j5, long j6, String str3, Promise promise) {
        try {
            String normalizePath = p.normalizePath(str2);
            if (!str.startsWith(e.f12765i) && new File(p.normalizePath(str)).isDirectory()) {
                promise.reject("EISDIR", "Expecting a file but '" + str + "' is a directory");
                return;
            }
            InputStream n5 = n(str);
            if (n5 == null) {
                promise.reject("ENOENT", "No such file '" + str + "'");
                return;
            }
            FileOutputStream fileOutputStream = new FileOutputStream(new File(normalizePath));
            long skip = n5.skip(j5);
            if (skip != j5) {
                promise.reject("EUNSPECIFIED", "Skipped " + skip + " instead of the specified " + j5 + " bytes");
                return;
            }
            byte[] bArr = new byte[10240];
            int i5 = (int) (j6 - j5);
            while (i5 > 0) {
                int read = n5.read(bArr, 0, 10240);
                if (read <= 0) {
                    break;
                }
                fileOutputStream.write(bArr, 0, Math.min(i5, read));
                i5 -= read;
            }
            n5.close();
            fileOutputStream.flush();
            fileOutputStream.close();
            promise.resolve(normalizePath);
        } catch (Exception e5) {
            e5.printStackTrace();
            promise.reject("EUNSPECIFIED", e5.getLocalizedMessage());
        }
    }

    static void y(String str, Callback callback) {
        try {
            String normalizePath = p.normalizePath(str);
            WritableMap z4 = z(normalizePath);
            if (z4 == null) {
                callback.invoke("failed to stat path `" + normalizePath + "` because it does not exist or it is not a folder", null);
            } else {
                callback.invoke(null, z4);
            }
        } catch (Exception e5) {
            callback.invoke(e5.getLocalizedMessage());
        }
    }

    static WritableMap z(String str) {
        try {
            String normalizePath = p.normalizePath(str);
            WritableMap createMap = Arguments.createMap();
            if (o(normalizePath)) {
                String replace = normalizePath.replace(e.f12764h, PointerEventHelper.POINTER_TYPE_UNKNOWN);
                AssetFileDescriptor openFd = h.f12779c.getAssets().openFd(replace);
                createMap.putString("filename", replace);
                createMap.putString(e.f12769m, normalizePath);
                createMap.putString("type", com.facebook.common.util.h.f15154f);
                createMap.putString("size", String.valueOf(openFd.getLength()));
                createMap.putInt("lastModified", 0);
            } else {
                File file = new File(normalizePath);
                if (!file.exists()) {
                    return null;
                }
                createMap.putString("filename", file.getName());
                createMap.putString(e.f12769m, file.getPath());
                createMap.putString("type", file.isDirectory() ? "directory" : "file");
                createMap.putString("size", String.valueOf(file.length()));
                createMap.putString("lastModified", String.valueOf(file.lastModified()));
            }
            return createMap;
        } catch (Exception unused) {
            return null;
        }
    }

    void w(String[] strArr, String[] strArr2, Callback callback) {
        try {
            MediaScannerConnection.scanFile(this.f12771a, strArr, strArr2, new b(callback));
        } catch (Exception e5) {
            callback.invoke(e5.getLocalizedMessage(), null);
        }
    }
}