01: /**********************************************************************************
02:
03: Feedzeo!
04: A free and open source RSS/Atom/RDF feed aggregator
05:
06: Copyright (C) 2005-2006 Anand Rao (anandrao@users.sourceforge.net)
07:
08: This library is free software; you can redistribute it and/or
09: modify it under the terms of the GNU Lesser General Public
10: License as published by the Free Software Foundation; either
11: version 2.1 of the License, or (at your option) any later version.
12:
13: This library is distributed in the hope that it will be useful,
14: but WITHOUT ANY WARRANTY; without even the implied warranty of
15: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16: Lesser General Public License for more details.
17:
18: You should have received a copy of the GNU Lesser General Public
19: License along with this library; if not, write to the Free Software
20: Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21:
22: ************************************************************************************/package util;
23:
24: import java.io.*;
25: import javax.swing.*;
26:
27: class DummyOutputStream extends OutputStream {
28: DummyOutputStream() {
29: }
30:
31: public void close() {
32: }
33:
34: public void flush() {
35: }
36:
37: public void write(byte[] b) {
38: }
39:
40: public void write(byte[] b, int off, int len) {
41: }
42:
43: public void write(int b) {
44: }
45: }
46:
47: public class WinPrintStream extends PrintStream {
48: private JTextArea textArea;
49:
50: public WinPrintStream(JTextArea textArea) {
51: super (new DummyOutputStream());
52: this .textArea = textArea;
53:
54: }
55:
56: private void writeString(String s) {
57: if (textArea != null) {
58: textArea.append(s);
59: textArea.append("\r\n");
60: }
61: }
62:
63: public void print(String s) {
64: writeString(s);
65: }
66:
67: public void println(String s) {
68: writeString(s);
69: }
70: }
|