HeaderTokenizer (Java EE 5)

Java EE API


javax.mail.internet Class HeaderTokenizer

java.lang.Object
  extended by javax.mail.internet.HeaderTokenizer

public class HeaderTokenizer
extends Object

Inner classes: HeaderTokenizer.Token

此类将 RFC822 和 MIME 的头标记成 RFC822 和 MIME 指定的基本符号。

此类处理折叠头(即嵌入了 CRLF SPACE 序列的头)。在返回的标记中移除折叠。

英文文档:

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.

Version:
1.11, 07/05/04
Author:
John Mani

Nested Class Summary
static class
 
Field Summary
static String
static String
 
Constructor Summary
 
Method Summary
 String
 HeaderTokenizer.Token
 HeaderTokenizer.Token
 
Methods inherited from class java.lang.Object
 

Field Detail

英文文档:

RFC822

public static final String RFC822
RFC822 specials

See Also:
Constant Field Values


英文文档:

MIME

public static final String MIME
MIME specials

See Also:
Constant Field Values

Constructor Detail

public HeaderTokenizer(String header, String delimiters, boolean skipComments)
带有 rfc822 样式头的构造方法。
header 要标记的 rfc822 头
delimiters 用于分隔 ATOM 的分界符字符集。这些字符通常是 RFC822MIME
skipComments 如果为 true,则跳过注释且不将它作为标记返回
英文文档:

HeaderTokenizer

public HeaderTokenizer(String header,
                       String delimiters,
                       boolean skipComments)
Constructor that takes a rfc822 style header.

Parameters:
header - The rfc822 header to be tokenized
delimiters - 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 tokens


public HeaderTokenizer(String header, String delimiters)
构造方法。注释被忽略且不作为标记返回。
header 被标记的头
delimiters 要使用的分界符。
英文文档:

HeaderTokenizer

public HeaderTokenizer(String header,
                       String delimiters)
Constructor. Comments are ignored and not returned as tokens

Parameters:
header - The header that is tokenized
delimiters - The delimiters to be used


public HeaderTokenizer(String header)
构造方法。使用 RFC822 定义的分界符 RFC822 来分隔 ATOM。注释同样被跳过且不作为标记返回。
英文文档:

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

Method Detail

public HeaderTokenizer.Token next() throws ParseException
解析此 String 的下一个标记。

客户端循环调用 next() 来解析后续标记,直到返回 EOF Token 为止。

return 下一个 Token
ThrowsParseException: 如果解析失败

英文文档:

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.

Returns:
the next Token
Throws:
ParseException - if the parse fails

public HeaderTokenizer.Token peek() throws ParseException
查看下一个标记,但没有从解析流中实际移除标记。多次调用此方法将返回后续的标记,直到调用 next() 为止。

return 下一个 Token
ThrowsParseException: 如果解析失败

英文文档:

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.

Returns:
the next Token
Throws:
ParseException - if the parse fails

public String getRemainder()
返回其余的头。
return 其余的头 (String);如果已到头的末尾,则返回 null。
英文文档:

getRemainder

public String getRemainder()
Return the rest of the Header.

Returns:
String rest of header. null is returned if we are already at end of header


Submit a bug or feature

Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.

一看就知道只有菜鸟才干这么无知的事啦。

PS : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!