Code example for ByteArrayOutputStream

Methods: reset, toString

0
     * Returns any new java.util.logging messages since this method was last called,  
     * or since this object was constructed if this method has not yet been called. 
     */ 
    public String getNewLogMessages() {
        streamHandler.flush();
        String text = baos.toString();
        baos.reset();
        return text;
    } 
}