package com.mbridge.msdk.playercommon.exoplayer2.util; import java.io.BufferedOutputStream; import java.io.IOException; import java.io.OutputStream; /* loaded from: classes4.dex */ public final class ReusableBufferedOutputStream extends BufferedOutputStream { private boolean closed; public ReusableBufferedOutputStream(OutputStream outputStream) { super(outputStream); } public ReusableBufferedOutputStream(OutputStream outputStream, int i) { super(outputStream, i); } @Override // java.io.FilterOutputStream, java.io.OutputStream, java.io.Closeable, java.lang.AutoCloseable public final void close() throws IOException { this.closed = true; try { flush(); th = null; } catch (Throwable th) { th = th; } try { ((BufferedOutputStream) this).out.close(); } catch (Throwable th2) { if (th == null) { th = th2; } } if (th != null) { Util.sneakyThrow(th); } } public final void reset(OutputStream outputStream) { Assertions.checkState(this.closed); ((BufferedOutputStream) this).out = outputStream; ((BufferedOutputStream) this).count = 0; this.closed = false; } }