public void data(InputStream data) throws TooMuchDataException, IOException { if (this.deliveries.size() == 1) { this.deliveries.get(0).deliver(data); } else { DeferredFileOutputStream dfos = new DeferredFileOutputStream(SmarterMessageListenerAdapter.this.dataDeferredSize); try { int value; while ((value = data.read()) >= 0) { dfos.write(value); } for (Receiver rec : this.deliveries) { rec.deliver(dfos.getInputStream()); } } finally { dfos.close(); } } }
public void done() { for (Receiver rec : this.deliveries) { rec.done(); } }