1 57 58 package org.apache.soap.util.net; 59 60 import java.io.*; 61 import java.net.*; 62 import java.awt.TextArea ; 63 64 71 public class Relay extends Thread { 72 final static int BUFSIZ = 1000; 73 InputStream in; 74 OutputStream out; 75 byte buf[] = new byte[BUFSIZ]; 76 TextArea ta; 77 78 Relay (InputStream in, OutputStream out, TextArea ta) { 79 this.in = in; 80 this.out = out; 81 this.ta = ta; 82 } 83 84 public void run () { 85 int n; 86 87 try { 88 while ((n = in.read (buf)) > 0) { 89 out.write (buf, 0, n); 90 out.flush (); 91 if (ta != null) { 92 ta.append (new String (buf, 0, n, "8859_1")); 93 } 94 } 95 } catch (IOException e) { 96 } finally { 97 try { 98 in.close (); 99 out.close (); 100 } catch (IOException e) { 101 } 102 } 103 } 104 } 105 | Popular Tags |