Package org.apache.james.mime4j.stream
Interface EntityStateMachine
-
- All Known Implementing Classes:
RawEntity
public interface EntityStateMachine
Represents the interal state of a MIME entity, which is being retrieved from an input stream by a MIME parser.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description EntityStateMachine
advance()
Advances the state machine to the next state in the process of the MIME stream parsing.BodyDescriptor
getBodyDescriptor()
Returns description of the entity body.InputStream
getContentStream()
Returns content stream of the entity body.InputStream
getDecodedContentStream()
Returns the decoded content stream of the entity body.Field
getField()
Returns current header field.EntityState
getState()
Return the current state of the entity.void
setRecursionMode(RecursionMode recursionMode)
Sets the current recursion mode.
-
-
-
Method Detail
-
getState
EntityState getState()
Return the current state of the entity.- Returns:
- current state
- See Also:
EntityState
-
setRecursionMode
void setRecursionMode(RecursionMode recursionMode)
Sets the current recursion mode. The recursion mode specifies the approach taken to parsing parts.RecursionMode.M_RAW
mode does not parse the part at all.RecursionMode.M_RECURSE
mode recursively parses each mail when anmessage/rfc822
part is encounted;RecursionMode.M_NO_RECURSE
does not.- Parameters:
recursionMode
-- See Also:
RecursionMode
-
advance
EntityStateMachine advance() throws IOException, MimeException
Advances the state machine to the next state in the process of the MIME stream parsing. This method may return an new state machine that represents an embedded entity, which must be parsed before the parsing process of the current entity can proceed.- Returns:
- a state machine of an embedded entity, if encountered,
null
otherwise. - Throws:
IOException
- if an I/O error occurs.MimeException
- if the message can not be processed due to the MIME specification violation.
-
getBodyDescriptor
BodyDescriptor getBodyDescriptor() throws IllegalStateException
Returns description of the entity body.- Returns:
- body description
- Throws:
IllegalStateException
- if the body description cannot be obtained at the current stage of the parsing process.
-
getContentStream
InputStream getContentStream() throws IllegalStateException
Returns content stream of the entity body.- Returns:
- input stream
- Throws:
IllegalStateException
- if the content stream cannot be obtained at the current stage of the parsing process.
-
getDecodedContentStream
InputStream getDecodedContentStream() throws IllegalStateException
Returns the decoded content stream of the entity body.- Returns:
- input stream
- Throws:
IllegalStateException
- if the content stream cannot be obtained at the current stage of the parsing process.
-
getField
Field getField() throws IllegalStateException
Returns current header field.- Returns:
- header field
- Throws:
IllegalStateException
- if a header field cannot be obtained at the current stage of the parsing process.
-
-