KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > hudson > util > StreamCopyThread


1 package hudson.util;
2
3 import hudson.Util;
4
5 import java.io.IOException JavaDoc;
6 import java.io.InputStream JavaDoc;
7 import java.io.OutputStream JavaDoc;
8
9 /**
10  * {@link Thread} that copies {@link InputStream} to {@link OutputStream}.
11  *
12  * @author Kohsuke Kawaguchi
13  */

14 public class StreamCopyThread extends Thread JavaDoc {
15     private final InputStream JavaDoc in;
16     private final OutputStream JavaDoc out;
17
18     public StreamCopyThread(String JavaDoc threadName, InputStream JavaDoc in, OutputStream JavaDoc out) {
19         super(threadName);
20         this.in = in;
21         this.out = out;
22     }
23
24     public void run() {
25         try {
26             Util.copyStream(in,out);
27             in.close();
28         } catch (IOException JavaDoc e) {
29             // TODO: what to do?
30
}
31     }
32 }
33
Popular Tags