package terminal; import java.io.IOException; import java.io.PipedInputStream; import java.io.PipedOutputStream; import com.googlecode.lanterna.terminal.IOSafeTerminal; import stream.UncheckedIOException; public class TerminalConfiguration { private PipedOutputStream inputWriter; private PipedInputStream inputReader; private PipedOutputStream outputWriter; private PipedInputStream outputReader; private IOSafeTerminal terminal; public void setInputPair(PipedOutputStream inputWriter, PipedInputStream inputReader) { this.inputWriter = inputWriter; this.inputReader = inputReader; connectInputPair(); } private void connectInputPair() { try { inputWriter.connect(inputReader); } catch (IOException e) { throw new UncheckedIOException(e); } } public void setOutputPair(PipedOutputStream outputWriter, PipedInputStream outputReader) { this.outputWriter = outputWriter; this.outputReader = outputReader; connectOutputPair(); } private void connectOutputPair() { try { outputWriter.connect(outputReader); } catch (IOException e) { throw new UncheckedIOException(e); } } public void setTerminal(IOSafeTerminal terminal) { this.terminal = terminal; } public PipedOutputStream getInputWriter() { return inputWriter; } public PipedInputStream getInputReader() { return inputReader; } public PipedOutputStream getOutputWriter() { return outputWriter; } public PipedInputStream getOutputReader() { return outputReader; } public IOSafeTerminal getTerminal() { return terminal; } }