Class AddressFormatter

java.lang.Object
org.apache.james.mime4j.field.address.AddressFormatter

public class AddressFormatter extends Object
Default formatter for Address and its subclasses.
  • Field Details

  • Constructor Details

    • AddressFormatter

      protected AddressFormatter()
  • Method Details

    • format

      public void format(StringBuilder sb, Address address, boolean includeRoute)

      Formats the address as a human readable string, not including the route. The resulting string is intended for display purposes only and cannot be used for transport purposes.

      For example, if the unparsed address was
      <"Joe Cheng"@joecheng.com>
      this method would return
      <Joe Cheng@joecheng.com>
      which is not valid for transport; the local part would need to be re-quoted.

      Parameters:
      includeRoute - true if the route should be included if it exists, false otherwise.
    • encode

      public void encode(StringBuilder sb, Address address)
      Returns a string representation of this address that can be used for transport purposes. The route is never included in this representation because routes are obsolete and RFC 5322 states that obsolete syntactic forms MUST NOT be generated.
    • format

      public void format(StringBuilder sb, Mailbox mailbox, boolean includeRoute)
    • format

      public String format(Mailbox mailbox, boolean includeRoute)
    • encode

      public void encode(StringBuilder sb, Mailbox mailbox)
    • encode

      public String encode(Mailbox mailbox)
    • format

      public void format(StringBuilder sb, Group group, boolean includeRoute)
    • format

      public String format(Group group, boolean includeRoute)
    • encode

      public void encode(StringBuilder sb, Group group)
    • encode

      public String encode(Group group)