类 MimeTokenStream
java.lang.Object
com.sh.mail.mime4j.stream.MimeTokenStream
Description:
Title:首亨软件 - TSS/CRM等
- 从以下版本开始:
- Aug 16, 2012
-
构造器概要
构造器构造器说明Constructs a standard (lax) stream.MimeTokenStream(MimeConfig config) MimeTokenStream(MimeConfig config, DecodeMonitor monitor, BodyDescriptorBuilder bodyDescBuilder) MimeTokenStream(MimeConfig config, DecodeMonitor monitor, FieldBuilder fieldBuilder, BodyDescriptorBuilder bodyDescBuilder) MimeTokenStream(MimeConfig config, BodyDescriptorBuilder bodyDescBuilder) -
方法概要
修饰符和类型方法说明Gets a descriptor for the current entity.This method returns a transfer decoded stream based on the MIME fields with the standard defaults.getField()This method is valid, ifgetState()returnsEntityState.T_FIELD.Gets a reader configured for the current body or body part.Gets the current recursion mode.getState()Returns the current state.booleanisRaw()Determines if this parser is currently in raw mode.next()This method advances the token stream to the next token.voidparse(InputStream stream) Instructs theMimeTokenStreamto parse the given streams contents.parseHeadless(InputStream stream, String contentType) Instructs theMimeTokenStreamto parse the given content with the content type.voidSets the current recursion.static final StringstateToString(EntityState state) Renders a state as a string suitable for logging.voidstop()Finishes the parsing and stops reading lines.
-
构造器详细资料
-
MimeTokenStream
public MimeTokenStream()Constructs a standard (lax) stream. Optional validation events will be logged only. UseMimeConfig.setStrictParsing(boolean)to turn on strict parsing mode and pass the config object toMimeTokenStream(MimeConfig)to create a stream that strictly validates the input. -
MimeTokenStream
-
MimeTokenStream
-
MimeTokenStream
public MimeTokenStream(MimeConfig config, DecodeMonitor monitor, BodyDescriptorBuilder bodyDescBuilder) -
MimeTokenStream
public MimeTokenStream(MimeConfig config, DecodeMonitor monitor, FieldBuilder fieldBuilder, BodyDescriptorBuilder bodyDescBuilder)
-
-
方法详细资料
-
parse
Instructs theMimeTokenStreamto parse the given streams contents. If theMimeTokenStreamhas already been in use, resets the streams internal state.- 参数:
stream- InputStream
-
parseHeadless
Instructs the
MimeTokenStreamto parse the given content with the content type. The message stream is assumed to have no message header and is expected to begin with a message body. This can be the case when the message content is transmitted using a different transport protocol such as HTTP.If the
MimeTokenStreamhas already been in use, resets the streams internal state.- 参数:
stream- InputStreamcontentType- String- 返回:
- a parsed Field representing the input contentType
-
isRaw
public boolean isRaw()Determines if this parser is currently in raw mode.- 返回:
trueif in raw mode,falseotherwise.- 另请参阅:
-
getRecursionMode
Gets the current recursion mode. The recursion mode specifies the approach taken to parsing parts.RecursionMode.M_RAWmode does not parse the part at all.RecursionMode.M_RECURSEmode recursively parses each mail when anmessage/rfc822part is encountered;RecursionMode.M_NO_RECURSEdoes not. -
setRecursionMode
Sets the current recursion. The recursion mode specifies the approach taken to parsing parts.RecursionMode.M_RAWmode does not parse the part at all.RecursionMode.M_RECURSEmode recursively parses each mail when anmessage/rfc822part is encountered;RecursionMode.M_NO_RECURSEdoes not.- 参数:
mode-RecursionMode.M_RECURSE,RecursionMode.M_RAWorRecursionMode.M_NO_RECURSE
-
stop
public void stop()Finishes the parsing and stops reading lines. NOTE: No more lines will be parsed but the parser will still trigger 'end' events to match previously triggered 'start' events. -
getState
Returns the current state.- 返回:
- EntityState
-
getInputStream
-
getDecodedInputStream
This method returns a transfer decoded stream based on the MIME fields with the standard defaults. This method is valid, ifgetState()returns either ofEntityState.T_RAW_ENTITY,EntityState.T_PREAMBLE, orEntityState.T_EPILOGUE.- 返回:
- Data stream, depending on the current state.
- 抛出:
IllegalStateException-getState()returns an invalid value.
-
getReader
Gets a reader configured for the current body or body part. The reader will return a transfer and charset decoded stream of characters based on the MIME fields with the standard defaults. This is a conveniance method and relies on {link #getInputStream()}. Consult the javadoc for that method for known limitations.- 返回:
- Reader
-
getBodyDescriptor
Gets a descriptor for the current entity. This method is valid if
getState()returns:- 返回:
BodyDescriptor, not nulls
-
getField
This method is valid, ifgetState()returnsEntityState.T_FIELD.- 返回:
- String with the fields raw contents.
- 抛出:
IllegalStateException-getState()returns another value thanEntityState.T_FIELD.
-
next
This method advances the token stream to the next token.- 返回:
- EntityState
- 抛出:
IllegalStateException- The method has been called, althoughgetState()was alreadyEntityState.T_END_OF_STREAM.IOException- IOExceptionMimeException- MimeException
-
stateToString
Renders a state as a string suitable for logging.- 参数:
state- EntityState- 返回:
- rendered as string, not null
-
getConfig
-