Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: org/mitre/cvw/console/ConsoleStream.java


1   /*
2    * Copyright (c) 1996-2000. The MITRE Corporation (http://www.mitre.org/).
3    * All rights reserved.
4    * CVW comes with ABSOLUTELY NO WARRANTY. See license for details.
5    */
6   
7   package org.mitre.cvw.console;
8   
9   import java.io.*;
10  import javax.swing.*;
11  
12  /** Console stream implementation
13   * This class copies any stream input into the textArea passed in the constructor
14   * 
15   * @author S.R.Jones
16   * @version 1.0
17   */
18  class ConsoleStream extends PrintStream {
19    private JTextArea textArea;
20    
21    /** Constructor
22     *
23     * @param os A system OutputStream, either System.out or System.err
24     * @param textArea A JTextArea widget to copy any output to.
25     */
26    public ConsoleStream(OutputStream os, JTextArea textArea) {
27      super(os);
28      this.textArea = textArea;
29    }
30    
31    public void print(boolean b) {
32      textArea.append(b + "");
33    }
34  
35    public void print(char c) {
36      textArea.append(String.valueOf(c));
37    }
38  
39    public void print(char[] c) {
40      textArea.append(new String(c));
41    }
42  
43    public void print(double d) {
44      textArea.append(d + "");
45    }
46  
47    public void print(float f) {
48      textArea.append(f + "");
49    }
50  
51    public void print(int i) {
52      textArea.append(i + "");
53    }
54  
55    public void print(long l) {
56      textArea.append(l + "");
57    }
58  
59    public void print(Object o) {
60      textArea.append(o.toString());
61    }
62  
63    public void print(String s) {
64      textArea.append(s);
65    }
66  
67    public void println() {
68      textArea.append("\n");
69    }
70  
71    public void println(boolean b) {
72      textArea.append(b + "\n");
73    }
74  
75    public void println(char c) {
76      textArea.append(String.valueOf(c) + "\n");
77    }
78  
79    public void println(char[] c) {
80      textArea.append((new String(c)) + "\n");
81    }
82  
83    public void println(double d) {
84      textArea.append(d + "\n");
85    }
86  
87    public void println(float f) {
88      textArea.append(f + "\n");
89    }
90  
91    public void println(int i) {
92      textArea.append(i + "\n");
93    }
94  
95    public void println(long l) {
96      textArea.append(l + "\n");
97    }
98  
99    public void println(Object o) {
100     textArea.append(o.toString() + "\n");
101   }
102 
103   public void println(String s) {
104     textArea.append(s + "\n");
105   }
106 }