List of usage examples for org.apache.commons.io.output DeferredFileOutputStream getByteCount
public long getByteCount()
From source file:org.apache.maven.plugin.surefire.report.StatelessXmlReporter.java
private void addOutputStreamElement(OutputStreamWriter outputStreamWriter, OutputStream fw, EncodingOutputStream eos, XMLWriter xmlWriter, DeferredFileOutputStream stdOut, String name) { if (stdOut != null && stdOut.getByteCount() > 0) { xmlWriter.startElement(name);//from ww w . java2s .c om try { xmlWriter.writeText(""); // Cheat sax to emit element outputStreamWriter.flush(); stdOut.close(); eos.getUnderlying().write("<![CDATA[".getBytes()); // emit cdata stdOut.writeTo(eos); eos.getUnderlying().write("]]>".getBytes()); eos.flush(); } catch (IOException e) { throw new ReporterException("When writing xml report stdout/stderr", e); } xmlWriter.endElement(); } }