Ejemplo n.º 1
0
 private void copy(InputStream in, MessageConsole console) throws IOException {
   while (true) {
     int c = in.read();
     if (c == -1) {
       break;
     }
     String string = Character.toString((char) c);
     stringBuilder.append(string); // store output to check for errors and warnings
     console.print(string);
   }
 }
Ejemplo n.º 2
0
 private void copyStream(InputStream in, StringBuilder stringBuilder, boolean toConsole) {
   byte[] buffer = new byte[2048];
   try {
     int count = in.read(buffer);
     while (count != -1) {
       if (count > 0) {
         String str = new String(buffer, 0, count);
         stringBuilder.append(str);
         if (toConsole) {
           console.print(str);
         }
       }
       count = in.read(buffer);
     }
     in.close();
   } catch (IOException ioe) {
     DartCore.logError(ioe);
   }
 }