code: private static BufferedWriter ensureBuffered(Writer wtr) {
          if (wtr == null) throw new NullPointerException("Provided writer was null");
          return wtr instanceof BufferedWriter ? (BufferedWriter) wtr
                                               : new BufferedWriter(wtr);
      }
docs: Ensures a writer is buffered.
  
  @param wtr writer, may be buffered
  @return a BufferedWriter