public class HeaderTokenizer
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
HeaderTokenizer.Token
A token returned by the lexer.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
MIME
MIME specials.
|
static java.lang.String |
RFC822
RFC 822 specials.
|
Constructor and Description |
---|
HeaderTokenizer(java.lang.String header)
Constructor.
|
HeaderTokenizer(java.lang.String header,
java.lang.String delimiters)
Constructor.
|
HeaderTokenizer(java.lang.String header,
java.lang.String delimiters,
boolean skipComments)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getRemainder()
Returns the rest of the header.
|
HeaderTokenizer.Token |
next()
Returns the next token.
|
HeaderTokenizer.Token |
next(char endOfAtom)
Returns the next token.
|
HeaderTokenizer.Token |
next(char endOfAtom,
boolean keepEscapes)
Returns the next token.
|
HeaderTokenizer.Token |
peek()
Peeks at the next token.
|
public static final java.lang.String RFC822
public static final java.lang.String MIME
public HeaderTokenizer(java.lang.String header, java.lang.String delimiters, boolean skipComments)
header
- the RFC 822 header to be tokenizeddelimiters
- the delimiter characters to be used to delimit ATOMsskipComments
- whether to skip commentspublic HeaderTokenizer(java.lang.String header, java.lang.String delimiters)
header
- the RFC 822 header to be tokenizeddelimiters
- the delimiter characters to be used to delimit ATOMspublic HeaderTokenizer(java.lang.String header)
public HeaderTokenizer.Token next() throws ParseException
ParseException
- if the parse failspublic HeaderTokenizer.Token next(char endOfAtom) throws ParseException
endOfAtom
- if not NUL, character marking the end of an atomParseException
- if the parse failspublic HeaderTokenizer.Token next(char endOfAtom, boolean keepEscapes) throws ParseException
endOfAtom
- if not NUL, character marking the end of an atomkeepEscapes
- if true, keep backslashesParseException
- if the parse failspublic HeaderTokenizer.Token peek() throws ParseException
next()
.
Invoking this method multiple times returns successive tokens,
until next()
is called.ParseException
- if the parse failsParseException
public java.lang.String getRemainder()