package o; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; /* loaded from: classes.dex */ public final class wkW implements gaU { private final Opg b; @Override // o.gaU public final /* synthetic */ boolean d(InputStream inputStream, File file, unA una) { return e(inputStream, file); } public wkW(Opg opg) { this.b = opg; } private boolean e(InputStream inputStream, File file) { byte[] bArr = (byte[]) this.b.e(65536, byte[].class); FileOutputStream fileOutputStream = null; try { FileOutputStream fileOutputStream2 = new FileOutputStream(file); while (true) { try { int read = inputStream.read(bArr); if (read == -1) { break; } fileOutputStream2.write(bArr, 0, read); } catch (IOException unused) { fileOutputStream = fileOutputStream2; if (fileOutputStream != null) { try { fileOutputStream.close(); } catch (IOException unused2) { } } this.b.b(bArr); return false; } catch (Throwable th) { th = th; fileOutputStream = fileOutputStream2; if (fileOutputStream != null) { try { fileOutputStream.close(); } catch (IOException unused3) { } } this.b.b(bArr); throw th; } } fileOutputStream2.close(); try { fileOutputStream2.close(); } catch (IOException unused4) { } this.b.b(bArr); return true; } catch (IOException unused5) { } catch (Throwable th2) { th = th2; } } }