org.shlublu.javax.awt
Class TextComponentOutputStream

java.lang.Object
  |
  +--java.io.OutputStream
        |
        +--org.shlublu.javax.awt.TextComponentOutputStream

public class TextComponentOutputStream
extends java.io.OutputStream

Creation : 4 sept 2001 OutputStream which writes into standard awt TextComponent. The output method (append() vs setText()) is choosen depending of the given component. A maximal component's text capacity can be defined. When reached its capacity, the component will erase the beginning of its content.

Since:
0.1
See Also:
OutputStream

Field Summary
protected  java.lang.StringBuffer buffer
          Internal buffer
protected  java.awt.TextComponent component
          The component to write into
 
Constructor Summary
TextComponentOutputStream(java.awt.TextComponent componentGiven)
          Constructor
TextComponentOutputStream(java.awt.TextComponent componentGiven, int iMaxLinesGiven, int iStepGiven)
          Constructor
 
Method Summary
 void close()
          Close the stream, so it can't be used anymore.
 void flush()
          write the content to the component, flushing the internal buffer
 void write(byte[] aby)
          write from a byte array, according to the java.io.InputStream specification
 void write(byte[] aby, int iStart, int iLen)
          write from a byte array, according to the java.io.InputStream specification
 void write(int iByte)
          write a char, according to the java.io.OutputStream specifications
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

component

protected java.awt.TextComponent component
The component to write into

buffer

protected java.lang.StringBuffer buffer
Internal buffer
Constructor Detail

TextComponentOutputStream

public TextComponentOutputStream(java.awt.TextComponent componentGiven)
Constructor
Parameters:
TextComponent - The component to write into

TextComponentOutputStream

public TextComponentOutputStream(java.awt.TextComponent componentGiven,
                                 int iMaxLinesGiven,
                                 int iStepGiven)
Constructor
Parameters:
TextComponent - The component to write into
int - iMaxLinesGiven The maximal text quantity (lines)
int - iStepGiven The number of lines to erase when capacity is reached
Throws:
java.lang.IllegalArgumentException - When iMaxLinesGiven < 0 || iStepGiven > iMaxLinesGiven
Method Detail

write

public void write(int iByte)
           throws java.io.IOException
write a char, according to the java.io.OutputStream specifications
Overrides:
write in class java.io.OutputStream
Throws:
java.io.IOException - as java.lang.OutputStream defines

write

public void write(byte[] aby)
           throws java.io.IOException
write from a byte array, according to the java.io.InputStream specification
Overrides:
write in class java.io.OutputStream
Parameters:
byte - [] the array
Throws:
java.io.IOException - as java.lang.OutputStream define
NullPointerException - if the given array is null

write

public void write(byte[] aby,
                  int iStart,
                  int iLen)
           throws java.io.IOException
write from a byte array, according to the java.io.InputStream specification
Overrides:
write in class java.io.OutputStream
Parameters:
byte - [] the array
int - iStart the index to begin at
int - iLen the length to write
Throws:
java.io.IOException - as java.lang.OutputStream define
NullPointerException - if the given array is null
java.lang.IndexOutOfBoundsException - if the indexes or length are wrong

flush

public void flush()
           throws java.io.IOException
write the content to the component, flushing the internal buffer
Overrides:
flush in class java.io.OutputStream
Throws:
java.io.IOException - as java.lang.OutputStream define

close

public void close()
           throws java.io.IOException
Close the stream, so it can't be used anymore.
Overrides:
close in class java.io.OutputStream
Throws:
java.io.IOException - as java.lang.OutputStream define