01: package org.zilonis.tool.ui.shell.io;
02:
03: import java.io.IOException;
04: import java.io.OutputStream;
05:
06: import org.zilonis.tool.ui.shell.InterpreterTextArea;
07:
08: public class CustomOutputStream extends OutputStream {
09:
10: private InterpreterTextArea textArea;
11:
12: public CustomOutputStream(InterpreterTextArea textArea) {
13: this .textArea = textArea;
14: }
15:
16: @Override
17: public void write(int i) throws IOException {
18: String txt = new String(new char[] { (char) (i & 0xff) });
19: try {
20: textArea.getDocument().insertString(
21: textArea.getDocument().getLength(), txt, null);
22: textArea.resetCurrentPosition();
23: } catch (Exception e) {
24: e.printStackTrace();
25: }
26: }
27:
28: }
|