grendel.storage.addressparser
Class RFC822AddressList

java.lang.Object
  |
  +--grendel.storage.addressparser.RFC822AddressList
Direct Known Subclasses:
AddressCorrector, RFC822MailboxList

public class RFC822AddressList
extends java.lang.Object

This class lets you instantiate an address list object from an input string (usually the right hand side to a To: field). You can then detect if they were all valid addresses, or there was some error. You can also access the individual address string to send the address list back out again.


Constructor Summary
RFC822AddressList(java.lang.String str)
          The input string (usually a To: field) is first tokenized, and then parsed into a list of addresses.
 
Method Summary
 java.lang.String getAddressString(int indx)
           
 java.lang.String getErrorString()
           
 boolean isError()
          Were there errors in tokenizing and parsing this string?
 int size()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RFC822AddressList

public RFC822AddressList(java.lang.String str)
The input string (usually a To: field) is first tokenized, and then parsed into a list of addresses.
Method Detail

size

public int size()
Returns:
Returns the number of addresses in the list. The string representation for each address is indexed from 0 to (size - 1). A return of 0 means an empty address list, probably a result of an error in parsing.

getAddressString

public java.lang.String getAddressString(int indx)
Parameters:
indx - an index from 0 to (size - 1).
Returns:
Either a String representation of the address, or null if the indx is outside the list. Also returns null is there was an error which resulted in no address list.

isError

public boolean isError()
Were there errors in tokenizing and parsing this string?

getErrorString

public java.lang.String getErrorString()
Returns:
A string describing the error if there was one. Some errors can return an empty string. No error in the address list returns "No error."