Code example for PrintWriter

Methods: flush

0
        errPrintln(s);
    } 
 
    public void exception(Throwable t, String format, Object... args) {
        StringWriter sw = new StringWriter();
        PrintWriter pw = new PrintWriter(sw);
        t.printStackTrace(pw);
        pw.flush();
        error(format + "\n" + sw.toString(), args);
    } 
 
    /** for unit testing */ 
    protected void errPrintln(String msg) {
        System.err.println(msg);
    } 
 
    /** for unit testing */ 
    protected void outPrintln(String msg) {
        System.out.println(msg);
    } 
Connect your IDE to all the code out there  Get Codota for Java