public class HeaderTokenizer extends 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 and Description |
---|---|
static class |
HeaderTokenizer.Token
The Token class represents tokens returned by the
HeaderTokenizer.
|
Modifier and Type | Field and Description |
---|---|
static String |
MIME
MIME specials
|
static String |
RFC822
RFC822 specials
|
Constructor and Description |
---|
HeaderTokenizer(String header)
Constructor.
|
HeaderTokenizer(String header,
String delimiters)
Constructor.
|
HeaderTokenizer(String header,
String delimiters,
boolean skipComments)
Constructor that takes a rfc822 style header.
|
Modifier and Type | Method and Description |
---|---|
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 String RFC822
public static final String MIME
public HeaderTokenizer(String header, 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(String header, String delimiters)
header
- The header that is tokenizeddelimiters
- The delimiters to be usedpublic HeaderTokenizer(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 String getRemainder()
Copyright © 1996-2013, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.