ChangeMonitorInputStream extends FilterInputStream { public byte[] getOriginal() { return original.toByteArray(); } ChangeMonitorInputStream(InputStream in); @Override boolean markSupported(); @Override int read(); @Override int read(byte[] b, int off, int len); byte[] getOriginal(); InputStream watch(InputStream in, String tag); CopyStream[] getModifiedStreams();  }
@Test public void testBasicCopy() throws Exception { InputStream in = new ByteArrayInputStream(original); ChangeMonitorInputStream cmis = new ChangeMonitorInputStream(in); in = cmis; int read = flush(in); assertEquals(original.length, read,"Read the wrong number of bytes"); compare(original, cmis.getOriginal()); }