1 18 19 package org.apache.tools.ant.taskdefs; 20 21 import java.io.IOException ; 22 import java.io.OutputStream ; 23 import org.apache.tools.ant.Task; 24 25 40 41 public class TaskOutputStream extends OutputStream { 42 43 private Task task; 44 private StringBuffer line; 45 private int msgOutputLevel; 46 47 51 52 TaskOutputStream(Task task, int msgOutputLevel) { 53 System.err.println("As of Ant 1.2 released in October 2000, the " 54 + "TaskOutputStream class"); 55 System.err.println("is considered to be dead code by the Ant " 56 + "developers and is unmaintained."); 57 System.err.println("Don\'t use it!"); 58 59 this.task = task; 60 this.msgOutputLevel = msgOutputLevel; 61 62 line = new StringBuffer (); 63 } 64 65 72 73 public void write(int c) throws IOException { 74 char cc = (char) c; 75 if (cc == '\r' || cc == '\n') { 76 if (line.length() > 0) { 78 processLine(); 79 } 80 } else { 81 line.append(cc); 82 } 83 } 84 85 88 89 private void processLine() { 90 String s = line.toString(); 91 task.log(s, msgOutputLevel); 92 line = new StringBuffer (); 93 } 94 } 95 96 | Popular Tags |