com.lightdev.app.ddnscl.io
Class TextComponentStream


java.lang.Object

  extended byjava.io.OutputStream

      extended bycom.lightdev.app.ddnscl.io.TextComponentStream


public class TextComponentStream
extends OutputStream

a custom OutputStream that allows to optionally echo output to a JTextArea.

In this application this stream is used to log messages to a JTextArea. For this purpose the application logger is extended by an additional StreamHandler which allows the logger to log to an instance of this class. Upon initialization of the application, a JTextArea is registered to this TextComponentStream so that all logging to this stream finally is shown in the JTextArea.

Version:
1, July 11, 2004
Author:
Ulrich Hilger, Light Development, http://www.lightdev.com, info@lightdev.com, published under the terms and conditions of the GNU General Public License, for details see file gpl.txt in the distribution package of this software as well as any licensing notes inside this documentation

Constructor Summary
TextComponentStream()
          constructor
 
Method Summary
 void flush()
          empty the output buffer and transfer buffered output to a text component (if one is registered with this stream)
 void setTextComponent(JTextArea ta)
          set the text component to which output shall be echoed
 void write(int b)
          write to an array list, i.e. buffer output until flush() is called which is when the buffered output is transferred to the text component and the buffer is cleared
 
Methods inherited from class java.io.OutputStream
close, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextComponentStream


public TextComponentStream()
constructor

Method Detail

setTextComponent


public void setTextComponent(JTextArea ta)
set the text component to which output shall be echoed

Parameters:
ta - JTextArea the component to echo to

write


public void write(int b)
write to an array list, i.e. buffer output until flush() is called which is when the buffered output is transferred to the text component and the buffer is cleared

Parameters:
b - int

flush


public void flush()
empty the output buffer and transfer buffered output to a text component (if one is registered with this stream)


Copyright (c) 2004 Ulrich Hilger