1 9 10 package org.netbeans.test.subversion.utils; 11 12 import java.io.BufferedInputStream ; 13 import java.io.BufferedOutputStream ; 14 import java.io.IOException ; 15 import java.io.InputStream ; 16 import java.io.OutputStream ; 17 18 22 public class StreamHandler extends Thread { 23 24 InputStream in; 25 OutputStream out; 26 27 28 public StreamHandler(InputStream in, OutputStream out) { 29 this.in = new BufferedInputStream (in); 30 this.out = new BufferedOutputStream (out); 31 } 32 33 public void run () { 34 try { 35 try { 36 try { 37 int i; 38 while((i = in.read()) != -1) { 39 out.write(i); 40 } 41 } finally { 42 in.close(); 43 } 44 out.flush(); 45 } finally { 46 out.close(); 47 } 48 } catch (IOException ex) { 49 ex.printStackTrace(); 50 } 51 } 52 } 53 | Popular Tags |