code: public FormatStringBuffer format(String str) {
  
          if (str == null) str = "<NULL>";
  
          Format fmt = getFormat();
  
          if (fmt.type != STRING) throw new IllegalArgumentException("Expected a String format");
  
          int len = str.length();
          if (fmt.precision != -1 && len > fmt.precision) len = fmt.precision;
  
          if ((fmt.flags & LEFT) != LEFT) while (len < fmt.fieldWidth--)
              buffer.append(' ');
  
          for (int i = 0; i < len; ++i)
              buffer.append(str.charAt(i));
  
          while (len < fmt.fieldWidth--)
              buffer.append(' ');
  
          return this;
      }
docs: Format a <tt>String</tt>.