code: public BulkOperation createBulkOperation(final Collection<?> objects, final boolean allOrNothing) {
  		try {
  			final PipedOutputStream out = new PipedOutputStream();
  			PipedInputStream in = new PipedInputStream(out);
  
  			Future<?> writeTask = executorService.submit(new Runnable() {
  
  				public void run() {
  					try {
  						bulkDocWriter.write(objects, allOrNothing, out);
  					} catch (Exception e) {
  						LOG.error("Caught exception while writing bulk document:", e);
  					}
  
  				}
  			});
  
  			return new BulkOperation(writeTask, in);
  		} catch (IOException e) {
  			throw Exceptions.propagate(e);
  		}
  	}
docs: /* (non-Javadoc)
  @see org.ektorp.impl.JsonSerializer#asInputStream(java.util.Collection, boolean)