@Test public void failedWrite() throws Exception { try { failedReleasableOutputStream.write('a'); } catch (IOException e) { } assertTrue(wasCalled.get()); }
@Override public void write(int b) throws IOException { try { delegate.write(b); } catch (IOException e) { safeClose(); throw e; } }
ReleasableOutputStream extends OutputStream { @Override public void write(int b) throws IOException { try { delegate.write(b); } catch (IOException e) { safeClose(); throw e; } } }
ReleasableOutputStream extends OutputStream { @Override public void write(int b) throws IOException { try { delegate.write(b); } catch (IOException e) { safeClose(); throw e; } } ReleasableOutputStream(OutputStream delegate, Runnable onClose); }
ReleasableOutputStream extends OutputStream { @Override public void write(int b) throws IOException { try { delegate.write(b); } catch (IOException e) { safeClose(); throw e; } } ReleasableOutputStream(OutputStream delegate, Runnable onClose); @Override void write(int b); @Override void write(byte[] b); @Override void write(byte[] b, int off, int len); @Override void flush(); @Override void close(); }
ReleasableOutputStream extends OutputStream { @Override public void write(int b) throws IOException { try { delegate.write(b); } catch (IOException e) { safeClose(); throw e; } } ReleasableOutputStream(OutputStream delegate, Runnable onClose); @Override void write(int b); @Override void write(byte[] b); @Override void write(byte[] b, int off, int len); @Override void flush(); @Override void close();  }