public AttributedCharacterIterator formatToCharacterIterator(Object date)
      throws IllegalArgumentException {
    if (date == null) throw new NullPointerException("null argument");
    if (!(date instanceof Date))
      throw new IllegalArgumentException("argument should be an instance of java.util.Date");

    AttributedFormatBuffer buf = new AttributedFormatBuffer();
    formatWithAttribute((Date) date, buf, null);
    buf.sync();

    return new FormatCharacterIterator(
        buf.getBuffer().toString(), buf.getRanges(), buf.getAttributes());
  }
  public StringBuffer format(Date date, StringBuffer buffer, FieldPosition pos) {
    formatWithAttribute(date, new StringFormatBuffer(buffer), pos);

    return buffer;
  }