public class HeaderTokenizer
extends java.lang.Object
This class handles folded headers (ie headers with embedded CRLF SPACE sequences). The folds are removed in the returned tokens.
Modifier and Type | Class | Description |
---|---|---|
static class |
HeaderTokenizer.Token |
The Token class represents tokens returned by the
HeaderTokenizer.
|
Modifier and Type | Field | Description |
---|---|---|
static java.lang.String |
MIME |
MIME specials
|
static java.lang.String |
RFC822 |
RFC822 specials
|
Constructor | 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 that takes a rfc822 style header.
|
Modifier and Type | Method | Description |
---|---|---|
java.lang.String |
getRemainder() |
Return the rest of the Header.
|
HeaderTokenizer.Token |
next() |
Parses the next token from this String.
|
HeaderTokenizer.Token |
next(char endOfAtom) |
Parses the next token from this String.
|
HeaderTokenizer.Token |
next(char endOfAtom,
boolean keepEscapes) |
Parses the next token from this String.
|
HeaderTokenizer.Token |
peek() |
Peek at the next token, without actually removing the token
from the parse stream.
|
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 rfc822 header to be tokenizeddelimiters
- Set of delimiter characters
to be used to delimit ATOMS. These
are usually RFC822
or
MIME
skipComments
- If true, comments are skipped and
not returned as tokenspublic HeaderTokenizer(java.lang.String header, java.lang.String delimiters)
header
- The header that is tokenizeddelimiters
- The delimiters to be usedpublic HeaderTokenizer(java.lang.String header)
header
- the header stringpublic HeaderTokenizer.Token next() throws ParseException
Clients sit in a loop calling next() to parse successive tokens until an EOF Token is returned.
ParseException
- if the parse failspublic HeaderTokenizer.Token next(char endOfAtom) throws ParseException
endOfAtom
- if not NUL, character marking end of tokenParseException
- if the parse failspublic HeaderTokenizer.Token next(char endOfAtom, boolean keepEscapes) throws ParseException
endOfAtom
- if not NUL, character marking end of tokenkeepEscapes
- keep all backslashes in returned string?ParseException
- if the parse failspublic HeaderTokenizer.Token peek() throws ParseException
next()
is
called. ParseException
- if the parse failspublic java.lang.String getRemainder()
Copyright © 2018 Oracle. All rights reserved.