Class s2iIOPlug

java.lang.Object
  |
  +--s2iIOPlug

class s2iIOPlug
extends java.lang.Object
implements java.lang.Runnable

A class for copying stream input to another stream or to a textarea.

Author:
Anish Malhotra, Cadence Design Systems

Field Summary
private  java.io.BufferedReader in
          The input stream to read from, buffered for efficiency
private  java.io.OutputStream out
          The output stream to print to (may be null)
(package private)  javax.swing.JTextArea txtArea
          The text area to print to (may be null)
 
Constructor Summary
s2iIOPlug(java.io.InputStream in, java.io.OutputStream out)
          Construct a plug that connects two streams
s2iIOPlug(javax.swing.JTextArea ta, java.io.InputStream in)
          Construct a plug that connects an input stream to a text area
 
Method Summary
 void run()
          Decide if output is to a text area or to a stream, and call the appropriate run method..
private  void run1()
          Copy bytes from an input stream to an output stream.
private  void run2()
          Copy bytes from an input stream to a text area.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

in

private java.io.BufferedReader in
The input stream to read from, buffered for efficiency

out

private java.io.OutputStream out
The output stream to print to (may be null)

txtArea

javax.swing.JTextArea txtArea
The text area to print to (may be null)
Constructor Detail

s2iIOPlug

public s2iIOPlug(java.io.InputStream in,
                 java.io.OutputStream out)
Construct a plug that connects two streams
Parameters:
in - The input stream to copy from
out - The output stream to copy to

s2iIOPlug

public s2iIOPlug(javax.swing.JTextArea ta,
                 java.io.InputStream in)
Construct a plug that connects an input stream to a text area
Parameters:
ta - The text area to copy to
in - The input stream to copy from
Method Detail

run1

private void run1()
Copy bytes from an input stream to an output stream. This returns only when there is no more input.

run2

private void run2()
Copy bytes from an input stream to a text area. This returns only when there is no more input.

run

public void run()
Decide if output is to a text area or to a stream, and call the appropriate run method.. This returns only when there is no more input.
Specified by:
run in interface java.lang.Runnable