home *** CD-ROM | disk | FTP | other *** search
Java Source | 1996-12-09 | 886 b | 36 lines |
- import java.io.OutputStream;
- import powersoft.jcm.ui.TextBox;
-
- public class TextBoxOutputStream extends OutputStream
- {
- public TextBoxOutputStream( TextBox box )
- {
- _box = box;
- }
-
- public void write( byte b[] )
- {
- StringBuffer buf = new StringBuffer(b.length);
- for( int i = 0; i < b.length; i++ ) {
- buf.append( (char)b[i] );
- }
- _box.setText( _box.getText() + buf.toString() );
- }
-
- public void write( byte b[], int off, int len )
- {
- StringBuffer buf = new StringBuffer(len);
- for( int i = 0; i < len; i++ ) {
- buf.append( (char) b[ off + i ] );
- }
- _box.setText( _box.getText() + buf.toString() );
- }
-
- public void write( int b )
- {
- _box.setText( _box.getText() + (char)b );
- }
-
- private TextBox _box;
- }
-