SK.gnome.dwarf.mail.smtp
Class SMTPUtils

java.lang.Object
  extended bySK.gnome.dwarf.mail.smtp.SMTPUtils

public class SMTPUtils
extends java.lang.Object

Provides useful SMTP helper methods.


Method Summary
static java.lang.String alignCenter(java.lang.String s, char c, int len)
          Alignes the string to the center.
static java.lang.String alignLeft(java.lang.String s, char c, int len)
          Alignes the string to the left.
static java.lang.String alignRight(java.lang.String s, char c, int len)
          Alignes the string to the right.
static java.lang.String formatSMTPDate(java.util.Date date)
          Formats the given date as per RFC 822.
static java.lang.String stripSourceRoutes(java.lang.String addr)
          Strips the source routes from the given address.
static java.lang.String wrapText(java.lang.String s)
          Wraps the text by dividing it to lines of max 78 characters.
static java.lang.String xtextDecode(java.lang.String s)
          Xtext-decodes the given string.
static java.lang.String xtextEncode(java.lang.String s)
          Xtext-encodes the given string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

stripSourceRoutes

public static java.lang.String stripSourceRoutes(java.lang.String addr)
Strips the source routes from the given address.

Parameters:
addr - the address
Returns:
the address without the source route information

xtextEncode

public static java.lang.String xtextEncode(java.lang.String s)
Xtext-encodes the given string.

Parameters:
s - the string
Returns:
the xtext-encoded string

xtextDecode

public static java.lang.String xtextDecode(java.lang.String s)
Xtext-decodes the given string.

Parameters:
s - the string
Returns:
the xtext-decoded string

wrapText

public static java.lang.String wrapText(java.lang.String s)
Wraps the text by dividing it to lines of max 78 characters.

It splits the input string into lines separated by CRLF sequences, each max 78 characters long, and returns it in a single string. The splitting is done by either space, horizontal tab or newline characters.

Parameters:
s - the string
Returns:
the string of CRLF-separated lines

formatSMTPDate

public static java.lang.String formatSMTPDate(java.util.Date date)
Formats the given date as per RFC 822.

Parameters:
date - the date
Returns:
the formatted date string

alignLeft

public static java.lang.String alignLeft(java.lang.String s,
                                         char c,
                                         int len)
Alignes the string to the left.

Parameters:
s - the string to bealigned
c - the padding character
len - the desired length of the string
Returns:
the aligned string

alignRight

public static java.lang.String alignRight(java.lang.String s,
                                          char c,
                                          int len)
Alignes the string to the right.

Parameters:
s - the string to bealigned
c - the padding character
len - the desired length of the string
Returns:
the aligned string

alignCenter

public static java.lang.String alignCenter(java.lang.String s,
                                           char c,
                                           int len)
Alignes the string to the center.

Parameters:
s - the string to bealigned
c - the padding character
len - the desired length of the string
Returns:
the aligned string


Copyright (c) 2004-2005, Gnome Ltd. All rights reserved.