private synchronized ByteArrayOutputStream writeCapturedData(SystemLogHolder holder, String txt, ByteArrayOutputStream capturedStream) {
        try {
            capturedStream.write(txt.getBytes());

            // If we're running in an Eclipse GUI, tee the output for usability
            if (IS_RUNNING_IN_ECLIPSE) {
                if (holder == systemErr && err != null) {
                    err.println(txt);
                } else if (out != null) {
                    out.println(txt);
                }
            }
            capturedStream.write(nl.getBytes());
            return capturedStream;
        } catch (IOException ioe) {
            super.writeStreamOutput(systemErr, "Unable to write/contain captured trace data", true);
            super.writeStreamOutput(holder, txt, false);
            return null;
        }
    }
private synchronized ByteArrayOutputStream writeCapturedData ( SystemLogHolder holder , String txt , ByteArrayOutputStream capturedStream ) { try { capturedStream . write ( txt . getBytes ( ) ) ; if ( IS_RUNNING_IN_ECLIPSE ) { if ( holder == systemErr && err != null ) { err . println ( txt ) ; } else if ( out != null ) { out . println ( txt ) ; } } capturedStream . write ( nl . getBytes ( ) ) ; return capturedStream ; } catch ( IOException ioe ) { super . writeStreamOutput ( systemErr , "Unable to write/contain captured trace data" , true ) ; super . writeStreamOutput ( holder , txt , false ) ; return null ; } }
Write the text from the string (and the text for a newline) into the captured
byte array. If all is well, return the hushed stream for the next write.
If there is an exception writing to the stream, return null to disable subsequent
writes.

@param holder LogHolder : system err or system out
@param txt Text to be logged
@param capturedStream stream holding captured data
@return capturedStream if all is well, null if an exception occurred writing to the stream