@Override public int read() throws IOException { checkAllExceptions(); return delegate.read(); }
@Override public boolean markSupported() { checkUndeclaredExceptions(); return delegate.markSupported(); } }
@Override void cat(final TestInputStream in, final TestOutputStream out) throws IOException { final ThrowControl control = TestConfig.get().getThrowControl(); control.trigger(ThrowingInputStream.class, expected); final ThrowingInputStream tis = new ThrowingInputStream(in, control); try { Streams.cat(tis, out); 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; } Streams.cat(in, out); } }.run();
@Override public int available() throws IOException { checkAllExceptions(); return delegate.available(); }
@Override public void mark(int readlimit) { checkUndeclaredExceptions(); delegate.mark(readlimit); }
@Override public void reset() throws IOException { checkAllExceptions(); delegate.reset(); }
private void checkAllExceptions() throws IOException { control.check(this, IOException.class); checkUndeclaredExceptions(); }
@Override public long skip(long n) throws IOException { checkAllExceptions(); return delegate.skip(n); }
@Override public void close() throws IOException { checkAllExceptions(); delegate.close(); }
@Override public int read(byte[] b, int off, int len) throws IOException { checkAllExceptions(); return delegate.read(b, off, len); }