1 package com.memoire.vainstall; 2 3 import java.io.IOException ; 4 import java.io.InputStream ; 5 6 11 12 class InputStreamToDetails extends Thread { 13 14 char[] buff = new char[128]; 15 InputStream input; 16 VAInstallStep step; 17 18 19 public InputStreamToDetails(InputStream input, 20 VAInstallStep step) 21 throws IOException { 22 super(); 23 this.input = input; 24 this.step = step; 25 } 26 27 public void run() { 28 try { 29 int buffidx = 0; 30 int aint = input.read(); 31 while (aint != -1) { 32 char achar = (char)aint; 33 buff[buffidx] = achar; 34 buffidx ++; 35 if (buffidx >= buff.length || achar == '\n') { 36 if (achar == '\n') buffidx --; 37 String txt = new String (buff, 0, buffidx); 38 step.details(txt); 39 VAGlobals.printDebug(txt); 40 buffidx = 0; 41 } 42 aint = input.read(); 43 yield(); 44 } 45 if (buffidx > 0) { 46 String txt = new String (buff, 0, buffidx); 47 step.details(txt); 48 } 49 input.close(); 50 } catch (IOException ioe) { 51 step.details(ioe.getMessage()); 52 } 53 } 54 55 } 56 | Popular Tags |