HeaderTokenizer (Java EE 5 SDK)

Java

Java EE 5 SDK

深圳电信培训中心.徐海蛟老师.


javax.mail.internet Class HeaderTokenizer

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

public class HeaderTokenizer
extends Object

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.

版本:
1.11, 07/05/04
作者:
John Mani

嵌套类摘要
static class HeaderTokenizer.Token
          The Token class represents tokens returned by the HeaderTokenizer.
 
字段摘要
static String MIME
          MIME specials
static String RFC822
          RFC822 specials
 
构造器摘要
HeaderTokenizer(String header)
          Constructor.
HeaderTokenizer(String header, String delimiters)
          Constructor.
HeaderTokenizer(String header, String delimiters, boolean skipComments)
          Constructor that takes a rfc822 style header.
 
方法摘要
 String getRemainder()
          Return the rest of the Header.
 HeaderTokenizer.Token next()
          Parses the next token from this String.
 HeaderTokenizer.Token peek()
          Peek at the next token, without actually removing the token from the parse stream.
 
类方法继承 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

RFC822

public static final String RFC822
RFC822 specials

另请参见:
常量字段


MIME

public static final String MIME
MIME specials

另请参见:
常量字段

构造器详细信息

HeaderTokenizer

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

参数:
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


HeaderTokenizer

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

参数:
header - The header that is tokenized
delimiters - The delimiters to be used


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

方法详细信息

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.

返回:
the next Token
抛出异常:
ParseException - if the parse fails

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.

返回:
the next Token
抛出异常:
ParseException - if the parse fails

getRemainder

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

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

Java EE 5 SDK

深圳电信培训中心.徐海蛟老师.


提交错误或意见

版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。深圳电信培训中心.徐海蛟老师教学参考.