some more thoughts ... thomas, if we make it like you wrote ...
class VirusScanner { public void scan(InputStream in) throws VirusFoundException { if(in instanceof DataStoreInputStream) { DataIdentifier di = ((DataStoreInputStream) in).getDataIdentifier(); if (hasScanned(di)) { // already exists, no need to copy return; } else { doScan(in); addScanned(di); } } else { doScan(in); } every module must handle this internally. it would be much finer to handle this more generic with a proxy in front of 'modules'. such proxy could store the dataIdentifier/result and a module key and if we try to process a binary a second time this proxy could check this and return without calling the module a second time. greets claus