Package org.apache.james.mime4j.field
Class DefaultFieldParser
- java.lang.Object
-
- org.apache.james.mime4j.field.DelegatingFieldParser
-
- org.apache.james.mime4j.field.DefaultFieldParser
-
- All Implemented Interfaces:
FieldParser<ParsedField>
public class DefaultFieldParser extends DelegatingFieldParser
Default (strict) implementation of theFieldParser
interface.
-
-
Field Summary
Fields Modifier and Type Field Description private static FieldParser<ParsedField>
PARSER
-
Constructor Summary
Constructors Constructor Description DefaultFieldParser()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static FieldParser<ParsedField>
getParser()
Gets the default instance of this class.static ParsedField
parse(java.lang.String rawStr)
static ParsedField
parse(java.lang.String rawStr, DecodeMonitor monitor)
Parses the given string and returns an instance of theParsedField
class.static ParsedField
parse(ByteSequence raw, DecodeMonitor monitor)
Parses the given byte sequence and returns an instance of theParsedField
class.-
Methods inherited from class org.apache.james.mime4j.field.DelegatingFieldParser
getParser, parse, setFieldParser
-
-
-
-
Field Detail
-
PARSER
private static final FieldParser<ParsedField> PARSER
-
-
Method Detail
-
getParser
public static FieldParser<ParsedField> getParser()
Gets the default instance of this class.- Returns:
- the default instance
-
parse
public static ParsedField parse(ByteSequence raw, DecodeMonitor monitor) throws MimeException
Parses the given byte sequence and returns an instance of theParsedField
class. The type of the class returned depends on the field name; seeparse(String)
for a table of field names and their corresponding classes.- Parameters:
raw
- the bytes to parse.monitor
- decoding monitor used while parsing/decoding.- Returns:
- a parsed field.
- Throws:
MimeException
- if the raw string cannot be split into field name and body.
-
parse
public static ParsedField parse(java.lang.String rawStr, DecodeMonitor monitor) throws MimeException
Parses the given string and returns an instance of the
ParsedField
class. The type of the class returned depends on the field name:Class returned Field names ContentTypeField
Content-Type ContentLengthField
Content-Length ContentTransferEncodingField
Content-Transfer-Encoding ContentDispositionField
Content-Disposition ContentDescriptionField
Content-Description ContentIdField
Content-ID ContentMD5Field
Content-MD5 ContentLanguageField
Content-Language ContentLocationField
Content-Location MimeVersionField
MIME-Version DateTimeField
Date, Resent-Date MailboxField
Sender, Resent-Sender MailboxListField
From, Resent-From AddressListField
To, Cc, Bcc, Reply-To, Resent-To, Resent-Cc, Resent-Bcc UnstructuredField
Subject and others - Parameters:
rawStr
- the string to parse.- Returns:
- a parsed field.
- Throws:
MimeException
- if the raw string cannot be split into field name and body.
-
parse
public static ParsedField parse(java.lang.String rawStr) throws MimeException
- Throws:
MimeException
-
-