org.montsuqi.widgets
Class TextPaneOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.ByteArrayOutputStream
          extended by org.montsuqi.widgets.TextPaneOutputStream
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable

public class TextPaneOutputStream
extends java.io.ByteArrayOutputStream

An output stream that writes text onto a JTextPane component.


Field Summary
 
Fields inherited from class java.io.ByteArrayOutputStream
buf, count
 
Constructor Summary
TextPaneOutputStream(javax.swing.JTextPane target)
          Creates a TextPaneOutputStream that writes text onto the given target.
TextPaneOutputStream(javax.swing.JTextPane target, int size)
          Creates a TextPaneOutputStream that writes text onto the given target.
 
Method Summary
 javax.swing.text.MutableAttributeSet getAttributeSet()
          Gets the attribute set which is used to write text.
 void write(byte[] b, int off, int len)
          Appends the given data to the target teext pane.
 
Methods inherited from class java.io.ByteArrayOutputStream
close, reset, size, toByteArray, toString, toString, toString, write, writeTo
 
Methods inherited from class java.io.OutputStream
flush, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TextPaneOutputStream

public TextPaneOutputStream(javax.swing.JTextPane target)

Creates a TextPaneOutputStream that writes text onto the given target.

Parameters:
target - The target text pane this stream writes on.

TextPaneOutputStream

public TextPaneOutputStream(javax.swing.JTextPane target,
                            int size)

Creates a TextPaneOutputStream that writes text onto the given target.

Parameters:
target - The target text pane this stream writes on.
size - the size of buffer.
Method Detail

getAttributeSet

public javax.swing.text.MutableAttributeSet getAttributeSet()

Gets the attribute set which is used to write text.

You can modify the returned attribute set since it is mutable.

Returns:
the MutableAttributeSet object.

write

public void write(byte[] b,
                  int off,
                  int len)

Appends the given data to the target teext pane.

Overrides:
write in class java.io.ByteArrayOutputStream