@Test public void testCloseMainIOException() { final ByteArrayOutputStream badOs = new ExceptionOnCloseByteArrayOutputStream(); final RecordCloseByteArrayOutputStream goodOs = new RecordCloseByteArrayOutputStream(); final TeeOutputStream tos = new TeeOutputStream(badOs, goodOs); try { tos.close(); Assert.fail("Expected " + IOException.class.getName()); } catch (final IOException e) { Assert.assertTrue(goodOs.closed); } }
@Override public void close() throws IOException { try { super.close(); } finally { this.branch.close(); } }
TeeOutputStream extends ProxyOutputStream { @Override public void close() throws IOException { try { super.close(); } finally { this.branch.close(); } } }
TeeOutputStream extends ProxyOutputStream { @Override public void close() throws IOException { try { super.close(); } finally { this.branch.close(); } } TeeOutputStream(final OutputStream out, final OutputStream branch); }
TeeOutputStream extends ProxyOutputStream { @Override public void close() throws IOException { try { super.close(); } finally { this.branch.close(); } } TeeOutputStream(final OutputStream out, final OutputStream branch); @Override synchronized void write(final byte[] b); @Override synchronized void write(final byte[] b, final int off, final int len); @Override synchronized void write(final int b); @Override void flush(); @Override void close(); }
TeeOutputStream extends ProxyOutputStream { @Override public void close() throws IOException { try { super.close(); } finally { this.branch.close(); } } TeeOutputStream(final OutputStream out, final OutputStream branch); @Override synchronized void write(final byte[] b); @Override synchronized void write(final byte[] b, final int off, final int len); @Override synchronized void write(final int b); @Override void flush(); @Override void close();  }