code: public PrintWriter format(Locale l, String format, Object ... args) {
          try {
              synchronized (lock) {
                  ensureOpen();
                  if ((formatter == null) || (formatter.locale() != l))
                      formatter = new Formatter(WeakProxy.forObject(this), l);
                  formatter.format(l, format, args);
                  if (autoFlush)
                      out.flush();
              }
          } catch (InterruptedIOException x) {
              Thread.currentThread().interrupt();
          } catch (IOException x) {
              trouble = true;
          }
          return this;
      }
docs: Writes a formatted string to this writer using the specified format
  string and arguments.  If automatic flushing is enabled, calls to this
  method will flush the output buffer.
  
  @param  l
  The {@linkplain java.util.Locale locale} to apply during
  formatting.  If <tt>l</tt> is <tt>null</tt> then no localization
  is applied.
  
  @param  format
  A format string as described in <a
  href="../util/Formatter.html#syntax">Format string syntax</a>.
  
  @param  args
  Arguments referenced by the format specifiers in the format
  string.  If there are more arguments than format specifiers, the
  extra arguments are ignored.  The number of arguments is
  variable and may be zero.  The maximum number of arguments is
  limited by the maximum dimension of a Java array as defined by
  <cite>The Java&trade; Virtual Machine Specification</cite>.
  The behaviour on a
  <tt>null</tt> argument depends on the <a
  href="../util/Formatter.html#syntax">conversion</a>.
  
  @throws  java.util.IllegalFormatException
  If a format string contains an illegal syntax, a format
  specifier that is incompatible with the given arguments,
  insufficient arguments given the format string, or other
  illegal conditions.  For specification of all possible
  formatting errors, see the <a
  href="../util/Formatter.html#detail">Details</a> section of the
  formatter class specification.
  
  @throws  NullPointerException
  If the <tt>format</tt> is <tt>null</tt>
  
  @return  This writer
  
  @since  1.5