org.objectweb.cjdbc.console.gui.jtools
Class JTextAreaWriter

java.lang.Object
  extended byjava.io.Writer
      extended byorg.objectweb.cjdbc.console.gui.jtools.JTextAreaWriter

public class JTextAreaWriter
extends java.io.Writer

A implementation of the java.io.Writer class which provides writing to a JTextArea via a stream.

Author:
Nicolas Modrzyk , Anthony Eden

Field Summary
private  java.lang.StringBuffer buffer
           
private  boolean closed
           
private  javax.swing.JTextArea textArea
           
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
JTextAreaWriter(javax.swing.JTextArea textArea)
          Constructor.
 
Method Summary
 void close()
          Close the stream.
 void flush()
          Flush the data that is currently in the buffer.
private  java.lang.StringBuffer getBuffer()
          Get the StringBuffer which holds the data prior to writing via a call to the flush() method.
 void setTextArea(javax.swing.JTextArea textArea)
          Set the JTextArea to write to.
 void write(char[] charArray)
          Write the given character array to the output stream.
 void write(char[] charArray, int offset, int length)
          Write the given character array to the output stream beginning from the given offset and proceeding to until the given length is reached.
 void write(int c)
          Write the given character to the output stream.
 void write(java.lang.String string)
          Write the given String to the output stream.
 void write(java.lang.String string, int offset, int length)
          Write the given String to the output stream beginning from the given offset and proceeding to until the given length is reached.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

closed

private boolean closed

textArea

private javax.swing.JTextArea textArea

buffer

private java.lang.StringBuffer buffer
Constructor Detail

JTextAreaWriter

public JTextAreaWriter(javax.swing.JTextArea textArea)
Constructor.

Parameters:
textArea - The JTextArea to write to.
Method Detail

setTextArea

public void setTextArea(javax.swing.JTextArea textArea)
Set the JTextArea to write to.

Parameters:
textArea - The JTextArea

close

public void close()
Close the stream.


flush

public void flush()
           throws java.io.IOException
Flush the data that is currently in the buffer.

Throws:
java.io.IOException - if fails

write

public void write(char[] charArray)
           throws java.io.IOException
Write the given character array to the output stream.

Parameters:
charArray - The character array
Throws:
java.io.IOException - if fails

write

public void write(char[] charArray,
                  int offset,
                  int length)
           throws java.io.IOException
Write the given character array to the output stream beginning from the given offset and proceeding to until the given length is reached.

Parameters:
charArray - The character array
offset - The start offset
length - The length to write
Throws:
java.io.IOException - if fails

write

public void write(int c)
           throws java.io.IOException
Write the given character to the output stream.

Parameters:
c - The character
Throws:
java.io.IOException - if fails

write

public void write(java.lang.String string)
           throws java.io.IOException
Write the given String to the output stream.

Parameters:
string - The String
Throws:
java.io.IOException - if fails

write

public void write(java.lang.String string,
                  int offset,
                  int length)
           throws java.io.IOException
Write the given String to the output stream beginning from the given offset and proceeding to until the given length is reached.

Parameters:
string - The String
offset - The start offset
length - The length to write
Throws:
java.io.IOException - if fails

getBuffer

private java.lang.StringBuffer getBuffer()
Get the StringBuffer which holds the data prior to writing via a call to the flush() method. This method should never return null.

Returns:
A StringBuffer


Copyright © 2002, 2005 - ObjectWeb Consortium - All Rights Reserved.