StreamResult implements ResultConsumer<K,V>, Closeable { @Override public void accept(ProductBin<K, V> bin) { try { os.writeObject( transform.apply(bin) ); os.flush(); } catch (IOException e) { throw new RuntimeException("Error streaming result object",e); } } StreamResult(OutputStream os);  StreamResult(OutputStream os, Function<ProductBin<K,V>,Object> transform); @Override void accept(ProductBin<K, V> bin); @Override void close(); ObjectOutputStream getPrintStream(); static StreamResult<K,V> of(Conveyor<K, ?, V> conv, OutputStream os, Function<ProductBin<K,V>,Object> transform); static StreamResult<K,V> of(Conveyor<K, ?, V> conv, OutputStream os); static StreamResult<K,V> of(Conveyor<K, ?, V> conv, File file, Function<ProductBin<K,V>,Object> transform); static StreamResult<K,V> of(Conveyor<K, ?, V> conv, File file); static StreamResult<K,V> of(Conveyor<K, ?, V> conv, String file, Function<ProductBin<K,V>,Object> transform); static StreamResult<K,V> of(Conveyor<K, ?, V> conv, String file);  }
@Test(expected = RuntimeException.class) public void failTest() throws IOException { OutputStream os = new ByteArrayOutputStream(); StreamResult<Integer,StreamResultTest> sr = new StreamResult<>(os); sr.accept(ResultConsumerTest.getProductBin(1,this)); }