1 18 package org.apache.tools.ant.taskdefs.cvslib; 19 20 import java.io.ByteArrayOutputStream ; 21 import java.io.IOException ; 22 import org.apache.tools.ant.BuildException; 23 import org.apache.tools.ant.taskdefs.PumpStreamHandler; 24 25 29 class RedirectingStreamHandler 30 extends PumpStreamHandler { 31 RedirectingStreamHandler(final ChangeLogParser parser) { 32 super(new RedirectingOutputStream(parser), 33 new ByteArrayOutputStream ()); 34 } 35 36 37 String getErrors() { 38 try { 39 final ByteArrayOutputStream error 40 = (ByteArrayOutputStream ) getErr(); 41 42 return error.toString("ASCII"); 43 } catch (final Exception e) { 44 return null; 45 } 46 } 47 48 49 public void stop() { 50 super.stop(); 51 try { 52 getErr().close(); 53 getOut().close(); 54 } catch (final IOException e) { 55 throw new BuildException(e); 57 } 58 } 59 } 60 61 | Popular Tags |