1 package com.knowgate.dfs; 2 3 import java.io.*; 4 5 import com.knowgate.debug.DebugFile; 6 import com.knowgate.misc.ByteStore; 7 8 29 35 36 public class StreamConnector extends Thread { 37 38 InputStream in; 39 ByteStore b; 40 int size; 41 boolean ready=false; 42 43 public StreamConnector(InputStream sin, int size) { 44 super(); 45 in=sin; 46 this.size=size; 47 b=null; 48 this.start(); 49 } 50 51 public void run(String content_type) { 52 b=ByteStore.getBinaryFromIS(in,size,content_type); 53 ready=true; 54 } 55 56 public ByteStore getResult() { 57 while (!ready) { 58 try { 59 sleep(500); 60 if (DebugFile.trace) DebugFile.write("."); 61 } catch(InterruptedException ex) { 62 } 63 } 64 if (DebugFile.trace) DebugFile.write("\n"); 65 return b; 66 } 67 68 } | Popular Tags |