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 |
|---|---|
| public static class | HeaderTokenizer.Token
The Token class represents tokens returned by the HeaderTokenizer. |
| Modifier and Type | Field and Description |
|---|---|
| private int | |
| private String | |
| private static final HeaderTokenizer. | |
| private int | |
| public static final String | MIME
MIME specials |
| private int | |
| private int | |
| public static final String | RFC822
RFC822 specials |
| private boolean | |
| private String |
| Access | Constructor and Description |
|---|---|
| public | HeaderTokenizer(String
The rfc822 header to be tokenized header, String Set of delimiter characters
to be used to delimit ATOMS. These
are usually delimiters, boolean RFC822 or
MIMEIf true, comments are skipped and
not returned as tokens skipComments)Constructor that takes a rfc822 style header. |
| public | HeaderTokenizer(String
The header that is tokenized header, String The delimiters to be used delimiters)Constructor. |
| public |
| Modifier and Type | Method and Description |
|---|---|
| private HeaderTokenizer. | |
| private static String | |
| private HeaderTokenizer. | |
| public String | Returns: String rest of header. null is returned if we are already at end of headerReturn the rest of the Header. |
| public HeaderTokenizer. | |
| public HeaderTokenizer. | Returns: the next Tokenif not NUL, character marking end of token endOfAtom)Parses the next token from this String. |
| public HeaderTokenizer. | Returns: the next Tokenif not NUL, character marking end of token endOfAtom, boolean keep all backslashes in returned string? keepEscapes)Parses the next token from this String. |
| public HeaderTokenizer. | Returns: the next TokenPeek at the next token, without actually removing the token from the parse stream. |
| private int | |
| private static String |
| currentPos | back to summary |
|---|---|
| private int currentPos | |
| delimiters | back to summary |
|---|---|
| private String delimiters | |
| EOFToken | back to summary |
|---|---|
| private static final HeaderTokenizer. | |
| maxPos | back to summary |
|---|---|
| private int maxPos | |
| MIME | back to summary |
|---|---|
| public static final String MIME MIME specials | |
| nextPos | back to summary |
|---|---|
| private int nextPos | |
| peekPos | back to summary |
|---|---|
| private int peekPos | |
| RFC822 | back to summary |
|---|---|
| public static final String RFC822 RFC822 specials | |
| skipComments | back to summary |
|---|---|
| private boolean skipComments | |
| string | back to summary |
|---|---|
| private String string | |
| HeaderTokenizer | back to summary |
|---|---|
| public HeaderTokenizer(String header, String delimiters, boolean skipComments) Constructor that takes a rfc822 style header. | |
| HeaderTokenizer | back to summary |
|---|---|
| public HeaderTokenizer(String header, String delimiters) Constructor. Comments are ignored and not returned as tokens | |
| HeaderTokenizer | back to summary |
|---|---|
| public HeaderTokenizer(String header) Constructor. The RFC822 defined delimiters - RFC822 - are used to delimit ATOMS. Also comments are skipped and not returned as tokens
| |
| collectString | back to summary |
|---|---|
| private HeaderTokenizer. | |
| filterToken | back to summary |
|---|---|
| private static String filterToken(String s, int start, int end, boolean keepEscapes) | |
| getNext | back to summary |
|---|---|
| private HeaderTokenizer. | |
| getRemainder | back to summary |
|---|---|
| public String getRemainder() Return the rest of the Header.
| |
| next | back to summary |
|---|---|
| public HeaderTokenizer. Parses the next token from this String. Clients sit in a loop calling next() to parse successive tokens until an EOF Token is returned.
| |
| next | back to summary |
|---|---|
| public HeaderTokenizer. Parses the next token from this String. If endOfAtom is not NUL, the token extends until the endOfAtom character is seen, or to the end of the header. This method is useful when parsing headers that don't obey the MIME specification, e.g., by failing to quote parameter values that contain spaces.
| |
| next | back to summary |
|---|---|
| public HeaderTokenizer. Parses the next token from this String. endOfAtom is handled as above. If keepEscapes is true, any backslash escapes are preserved in the returned string. This method is useful when parsing headers that don't obey the MIME specification, e.g., by failing to escape backslashes in the filename parameter.
| |
| peek | back to summary |
|---|---|
| public HeaderTokenizer. Peek at the next token, without actually removing the token
from the parse stream. Invoking this method multiple times
will return successive tokens, until
| |
| skipWhiteSpace | back to summary |
|---|---|
| private int skipWhiteSpace() | |
| trimWhiteSpace | back to summary |
|---|---|
| private static String trimWhiteSpace(String s) | |
| Modifier and Type | Field and Description |
|---|---|
| public static final int | ATOM
Token type indicating an ATOM. |
| public static final int | COMMENT
Token type indicating a comment. |
| public static final int | EOF
Token type indicating end of input. |
| public static final int | QUOTEDSTRING
Token type indicating a quoted string. |
| private int | |
| private String |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public int | |
| public String |
| ATOM | back to summary |
|---|---|
| public static final int ATOM Token type indicating an ATOM. | |
| COMMENT | back to summary |
|---|---|
| public static final int COMMENT Token type indicating a comment. The value field contains the comment string without the comment start and end symbols. | |
| EOF | back to summary |
|---|---|
| public static final int EOF Token type indicating end of input. | |
| QUOTEDSTRING | back to summary |
|---|---|
| public static final int QUOTEDSTRING Token type indicating a quoted string. The value field contains the string without the quotes. | |
| type | back to summary |
|---|---|
| private int type | |
| value | back to summary |
|---|---|
| private String value | |
| Token | back to summary |
|---|---|
| public Token(int type, String value) Constructor.
| |
| getType | back to summary |
|---|---|
| public int getType() Return the type of the token. If the token represents a delimiter or a control character, the type is that character itself, converted to an integer. Otherwise, it's value is one of the following:
| |
| getValue | back to summary |
|---|---|
| public String getValue() Returns the value of the token just read. When the current token is a quoted string, this field contains the body of the string, without the quotes. When the current token is a comment, this field contains the body of the comment.
| |