javax.mail.internet
Class HeaderTokenizer
java.lang.Object
javax.mail.internet.HeaderTokenizer
public class HeaderTokenizer
extends java.lang.Object
This class tokenizes RFC822 and MIME headers into the basic symbols
specified by RFC822 and MIME.
This class handles folded headers(ie headers with embedded CRLF SPACE
sequences). The folds are removed in the returned tokens.
static String | MIME - MIME specials
|
static String | RFC822 - RFC822 specials
|
MIME
public static final String MIME
MIME specials
RFC822
public static final String RFC822
RFC822 specials
HeaderTokenizer
public HeaderTokenizer(String header)
Constructor.
The RFC822 defined delimiters - RFC822 - are used to delimit ATOMS.
Also comments are skipped and not returned as tokens
HeaderTokenizer
public HeaderTokenizer(String header,
String delimiters)
Constructor.
Comments are ignored and not returned as tokens
header
- The header that is tokenizeddelimiters
- The delimiters to be used
HeaderTokenizer
public HeaderTokenizer(String header,
String delimiters,
boolean skipComments)
Constructor that takes a rfc822 style header.
header
- The rfc822 header to be tokenizeddelimiters
- Set of delimiter characters to be used to delimit ATOMS.
These are usually RFC822 or MIMEskipComments
- If true, comments are skipped and not returned
as tokens
getRemainder
public String getRemainder()
Return the rest of the header.
next
public HeaderTokenizer.Token next()
throws ParseException
Parses the next token from this String.
Clients sit in a loop calling
next()
to parse successive
tokens until an EOF Token is returned.
- the next token
ParseException
- if the parse fails
peek
public HeaderTokenizer.Token peek()
throws ParseException
Peek at the next token, without actually removing the token
from the parse stream.
Invoking this method multiple times will return successive tokens,
until next()
is called.
- the next peek token