public Console(final IO io, final Callable<ConsoleTask> taskFactory, final History history, final InputStream bindings) throws IOException {
assert io != null;
this.pipe = new InputPipe(io.streams, io.getTerminal(), new InputPipe.InterruptHandler() {
public boolean interrupt() throws Exception {
return interruptTask();
}
public boolean stop() throws Exception {
return false;
}
});
this.pipe.setName("Console InputPipe");
this.pipe.setDaemon(true);
this.io = new IO(new StreamSet(pipe.getInputStream(), io.streams.out, io.streams.err), null, io.out, io.err, true);
this.reader = new ConsoleReader(
this.io.streams.in,
this.io.out,
bindings,
io.getTerminal());
this.reader.setPaginationEnabled(true);
this.reader.setCompletionHandler(new CandidateListCompletionHandler());
this.reader.setHistory(history != null ? history : new MemoryHistory());
assert taskFactory != null;
this.taskFactory = taskFactory;
}