code: public void printStackTrace(Throwable e, PrintWriter os)
    {
      CharArrayWriter writer = new CharArrayWriter();
      PrintWriter pw = new PrintWriter(writer);
      
      e.printStackTrace(pw);
  
      pw.close();
      char []array = writer.toCharArray();
  
      CharBuffer cb = filter(array);
  
      if (os != null)
        os.print(cb.toString());
      else
        System.out.println(cb);
    }
docs: Filter a stack trace, replacing names.