package com.ubtech.utils; import android.graphics.Bitmap; import android.util.Log; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; /* loaded from: classes2.dex */ public class BitmapFile { public static File a(Bitmap bitmap, String str) throws IOException { return a(bitmap, Bitmap.CompressFormat.PNG, 100, str); } public static File a(Bitmap bitmap, Bitmap.CompressFormat compressFormat, int i, String str) throws IOException { BufferedOutputStream bufferedOutputStream = null; try { try { File file = new File(str); if (!new File(file.getParent()).exists()) { new File(file.getParent()).mkdirs(); } file.createNewFile(); BufferedOutputStream bufferedOutputStream2 = new BufferedOutputStream(new FileOutputStream(file)); try { bitmap.compress(compressFormat, i, bufferedOutputStream2); try { bufferedOutputStream2.close(); } catch (IOException e) { Log.e("Cache", e.getMessage()); } return file; } catch (Exception e2) { throw e2; } catch (Throwable th) { th = th; bufferedOutputStream = bufferedOutputStream2; if (bufferedOutputStream != null) { try { bufferedOutputStream.close(); } catch (IOException e3) { Log.e("Cache", e3.getMessage()); } } throw th; } } catch (Exception e4) { throw e4; } } catch (Throwable th2) { th = th2; } } /* JADX WARN: Multi-variable type inference failed */ /* JADX WARN: Removed duplicated region for block: B:27:0x0044 A[EXC_TOP_SPLITTER, SYNTHETIC] */ /* JADX WARN: Type inference failed for: r4v0, types: [android.graphics.Bitmap$Config] */ /* JADX WARN: Type inference failed for: r4v1 */ /* JADX WARN: Type inference failed for: r4v10 */ /* JADX WARN: Type inference failed for: r4v11 */ /* JADX WARN: Type inference failed for: r4v12 */ /* JADX WARN: Type inference failed for: r4v13 */ /* JADX WARN: Type inference failed for: r4v2, types: [java.io.InputStream] */ /* JADX WARN: Type inference failed for: r4v4 */ /* JADX WARN: Type inference failed for: r4v5 */ /* JADX WARN: Type inference failed for: r4v6 */ /* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:37:0x002d -> B:14:0x004d). Please report as a decompilation issue!!! */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct code enable 'Show inconsistent code' option in preferences */ public static android.graphics.Bitmap a(java.lang.String r3, android.graphics.Bitmap.Config r4, int r5) { /* boolean r0 = android.text.TextUtils.isEmpty(r3) r1 = 0 if (r0 == 0) goto L8 return r1 L8: java.io.File r0 = new java.io.File r0.(r3) boolean r3 = r0.exists() if (r3 == 0) goto L4d android.graphics.BitmapFactory$Options r3 = new android.graphics.BitmapFactory$Options r3.() r2 = 0 r3.inJustDecodeBounds = r2 r3.inPreferredConfig = r4 r3.inSampleSize = r5 java.io.FileInputStream r4 = new java.io.FileInputStream // Catch: java.lang.Throwable -> L33 java.io.FileNotFoundException -> L36 r4.(r0) // Catch: java.lang.Throwable -> L33 java.io.FileNotFoundException -> L36 android.graphics.Bitmap r1 = android.graphics.BitmapFactory.decodeStream(r4, r1, r3) // Catch: java.io.FileNotFoundException -> L31 java.lang.Throwable -> L41 r4.close() // Catch: java.lang.Exception -> L2c goto L4d L2c: r3 = move-exception r3.printStackTrace() goto L4d L31: r3 = move-exception goto L38 L33: r3 = move-exception r4 = r1 goto L42 L36: r3 = move-exception r4 = r1 L38: r3.printStackTrace() // Catch: java.lang.Throwable -> L41 if (r4 == 0) goto L4d r4.close() // Catch: java.lang.Exception -> L2c goto L4d L41: r3 = move-exception L42: if (r4 == 0) goto L4c r4.close() // Catch: java.lang.Exception -> L48 goto L4c L48: r4 = move-exception r4.printStackTrace() L4c: throw r3 L4d: return r1 */ throw new UnsupportedOperationException("Method not decompiled: com.ubtech.utils.BitmapFile.a(java.lang.String, android.graphics.Bitmap$Config, int):android.graphics.Bitmap"); } }