@Override public void close() throws IOException { checkAllExceptions(); delegate.close(); } }
private void checkAllExceptions() throws IOException { control.check(this, IOException.class); checkUndeclaredExceptions(); }
@Override void cat(final TestInputStream in, final TestOutputStream out) throws IOException { final ThrowControl control = TestConfig.get().getThrowControl(); control.trigger(ThrowingOutputStream.class, expected); final ThrowingOutputStream tos = new ThrowingOutputStream(out); Streams.cat(in, out); try { Streams.cat(in, tos); fail(); } catch (final IOException got) { if (!contains(got, expected)) throw got; } catch (final RuntimeException got) { if (!contains(got, expected)) throw got; } catch (final Error got) { if (!contains(got, expected)) throw got; } } }.run();
@Override public void flush() throws IOException { checkAllExceptions(); delegate.flush(); }
@Override public void write(int b) throws IOException { checkAllExceptions(); delegate.write(b); }
@Override public void write(byte[] b, int off, int len) throws IOException { checkAllExceptions(); delegate.write(b, off, len); }