/**********************************************************************************
Feedzeo!
A free and open source RSS/Atom/RDF feed aggregator
Copyright (C) 2005-2006 Anand Rao (anandrao@users.sourceforge.net)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
************************************************************************************/
package util;
import java.io.*;
import javax.swing.*;
class DummyOutputStream extends OutputStream
{
DummyOutputStream() { }
public void close() { }
public void flush() { }
public void write(byte[] b) {}
public void write(byte[] b, int off, int len) { }
public void write(int b) { }
}
public class WinPrintStream extends PrintStream
{
private JTextArea textArea;
public WinPrintStream (JTextArea textArea) {
super(new DummyOutputStream());
this.textArea = textArea;
}
private void writeString (String s) {
if (textArea != null) {
textArea.append(s);
textArea.append("\r\n");
}
}
public void print (String s) {
writeString(s);
}
public void println (String s) {
writeString(s);
}
}
|