Class Fields
java.lang.Object
org.apache.james.mime4j.field.Fields
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic AddressListFieldaddressList(String fieldName, Iterable<? extends Address> addresses) Creates an address-list field from the specified field name and mailbox or group addresses.private static AddressListFieldaddressList0(String fieldName, Iterable<? extends Address> addresses) static AddressListFieldCreates a Bcc field for the specified mailbox or group addresses.static AddressListFieldCreates a Bcc field for the specified mailbox or group address.static AddressListFieldCreates a Bcc field for the specified mailbox or group addresses.static AddressListFieldCreates a Cc field for the specified mailbox or group addresses.static AddressListFieldCreates a Cc field for the specified mailbox or group address.static AddressListFieldCreates a Cc field for the specified mailbox or group addresses.private static voidcheckValidFieldName(String fieldName) static ContentDispositionFieldcontentDisposition(String contentDisposition) Creates a Content-Disposition field from the specified raw field value.static ContentDispositionFieldcontentDisposition(String dispositionType, Iterable<NameValuePair> parameters) Creates a Content-Disposition field from the specified disposition type and parameters.static ContentDispositionFieldcontentDisposition(String dispositionType, String filename) Creates a Content-Disposition field from the specified disposition type and filename.static ContentDispositionFieldcontentDisposition(String dispositionType, String filename, long size) Creates a Content-Disposition field from the specified values.static ContentDispositionFieldcontentDisposition(String dispositionType, String filename, long size, Date creationDate, Date modificationDate, Date readDate) Creates a Content-Disposition field from the specified values.static ContentDispositionFieldcontentDisposition(String dispositionType, Map<String, String> parameters) Creates a Content-Disposition field from the specified disposition type and parameters.static ContentTransferEncodingFieldcontentTransferEncoding(String contentTransferEncoding) Creates a Content-Transfer-Encoding field from the specified raw field value.static ContentTypeFieldcontentType(String contentType) Creates a Content-Type field from the specified raw field value.static ContentTypeFieldcontentType(String mimeType, Iterable<NameValuePair> parameters) Creates a Content-Type field from the specified MIME type and parameters.static ContentTypeFieldcontentType(String mimeType, Map<String, String> parameters) Creates a Content-Type field from the specified MIME type and parameters.static ContentTypeFieldcontentType(String mimeType, NameValuePair... parameters) Creates a Content-Type field from the specified MIME type and parameters.static DateTimeFieldCreates a date field from the specified field name andDatevalue.static DateTimeFieldCreates a date field from the specified field name,DateandTimeZonevalues.static DateTimeFieldCreates a Date field from the specifiedDatevalue.private static DateTimeFieldprivate static StringencodeAddresses(Iterable<? extends Address> addresses) static MailboxListFieldCreates a From field for the specified mailbox addresses.static MailboxListFieldCreates a From field for the specified mailbox address.static MailboxListFieldCreates a From field for the specified mailbox addresses.static UnstructuredFieldgenerateMessageId(String hostname) Creates a Message-ID field for the specified host name.private static booleanisValidDispositionType(String dispositionType) private static booleanisValidMimeType(String mimeType) static MailboxFieldCreates a mailbox field from the specified field name and mailbox address.private static MailboxFieldstatic MailboxListFieldmailboxList(String fieldName, Iterable<Mailbox> mailboxes) Creates a mailbox-list field from the specified field name and mailbox addresses.private static MailboxListFieldmailboxList0(String fieldName, Iterable<Mailbox> mailboxes) static UnstructuredFieldCreates a Message-ID field with the given message ID.private static <F extends ParsedField>
Fparse(FieldParser<F> parser, String fieldName, String fieldBody) static AddressListFieldCreates a Reply-To field for the specified mailbox or group addresses.static AddressListFieldCreates a Reply-To field for the specified mailbox or group address.static AddressListFieldCreates a Reply-To field for the specified mailbox or group addresses.static MailboxFieldCreates a Sender field for the specified mailbox address.static UnstructuredFieldCreates a Subject field from the specified string value.static AddressListFieldCreates a To field for the specified mailbox or group addresses.static AddressListFieldCreates a To field for the specified mailbox or group address.static AddressListFieldCreates a To field for the specified mailbox or group addresses.static MimeVersionField
-
Field Details
-
FIELD_NAME_PATTERN
-
-
Constructor Details
-
Fields
private Fields()
-
-
Method Details
-
version
-
contentType
Creates a Content-Type field from the specified raw field value. The specified string gets folded into a multiple-line representation if necessary but is otherwise taken as is.- Parameters:
contentType- raw content type containing a MIME type and optional parameters.- Returns:
- the newly created Content-Type field.
-
contentType
Creates a Content-Type field from the specified MIME type and parameters.- Parameters:
mimeType- a MIME type (such as"text/plain"or"application/octet-stream").parameters- map containing content-type parameters such as"boundary".- Returns:
- the newly created Content-Type field.
-
contentType
Creates a Content-Type field from the specified MIME type and parameters.- Parameters:
mimeType- a MIME type (such as"text/plain"or"application/octet-stream").parameters- list of content-type parameter name/value pairs.- Returns:
- the newly created Content-Type field.
-
contentType
Creates a Content-Type field from the specified MIME type and parameters.- Parameters:
mimeType- a MIME type (such as"text/plain"or"application/octet-stream").parameters- array of content-type parameter name/value pairs.- Returns:
- the newly created Content-Type field.
-
contentTransferEncoding
Creates a Content-Transfer-Encoding field from the specified raw field value.- Parameters:
contentTransferEncoding- an encoding mechanism such as"7-bit"or"quoted-printable".- Returns:
- the newly created Content-Transfer-Encoding field.
-
contentDisposition
Creates a Content-Disposition field from the specified raw field value. The specified string gets folded into a multiple-line representation if necessary but is otherwise taken as is.- Parameters:
contentDisposition- raw content disposition containing a disposition type and optional parameters.- Returns:
- the newly created Content-Disposition field.
-
contentDisposition
public static ContentDispositionField contentDisposition(String dispositionType, Map<String, String> parameters) Creates a Content-Disposition field from the specified disposition type and parameters.- Parameters:
dispositionType- a disposition type (usually"inline"or"attachment").parameters- map containing disposition parameters such as"filename".- Returns:
- the newly created Content-Disposition field.
-
contentDisposition
public static ContentDispositionField contentDisposition(String dispositionType, Iterable<NameValuePair> parameters) Creates a Content-Disposition field from the specified disposition type and parameters.- Parameters:
dispositionType- a disposition type (usually"inline"or"attachment").parameters- list of disposition parameter name/value pairs.- Returns:
- the newly created Content-Disposition field.
-
contentDisposition
Creates a Content-Disposition field from the specified disposition type and filename.- Parameters:
dispositionType- a disposition type (usually"inline"or"attachment").filename- filename parameter value ornullif the parameter should not be included.- Returns:
- the newly created Content-Disposition field.
-
contentDisposition
public static ContentDispositionField contentDisposition(String dispositionType, String filename, long size) Creates a Content-Disposition field from the specified values.- Parameters:
dispositionType- a disposition type (usually"inline"or"attachment").filename- filename parameter value ornullif the parameter should not be included.size- size parameter value or-1if the parameter should not be included.- Returns:
- the newly created Content-Disposition field.
-
contentDisposition
public static ContentDispositionField contentDisposition(String dispositionType, String filename, long size, Date creationDate, Date modificationDate, Date readDate) Creates a Content-Disposition field from the specified values.- Parameters:
dispositionType- a disposition type (usually"inline"or"attachment").filename- filename parameter value ornullif the parameter should not be included.size- size parameter value or-1if the parameter should not be included.creationDate- creation-date parameter value ornullif the parameter should not be included.modificationDate- modification-date parameter value ornullif the parameter should not be included.readDate- read-date parameter value ornullif the parameter should not be included.- Returns:
- the newly created Content-Disposition field.
-
date
Creates a Date field from the specifiedDatevalue. The default time zone of the host is used to format the date.- Parameters:
date- date value for the header field.- Returns:
- the newly created Date field.
-
date
Creates a date field from the specified field name andDatevalue. The default time zone of the host is used to format the date.- Parameters:
fieldName- a field name such asDateorResent-Date.date- date value for the header field.- Returns:
- the newly created date field.
-
date
Creates a date field from the specified field name,DateandTimeZonevalues.- Parameters:
fieldName- a field name such asDateorResent-Date.date- date value for the header field.zone- the time zone to be used for formatting the date.- Returns:
- the newly created date field.
-
generateMessageId
Creates a Message-ID field for the specified host name.- Parameters:
hostname- host name to be included in the message ID ornullif no host name should be included.- Returns:
- the newly created Message-ID field.
-
messageId
Creates a Message-ID field with the given message ID.- Parameters:
messageId- message ID value.
-
subject
Creates a Subject field from the specified string value. The specified string may contain non-ASCII characters.- Parameters:
subject- the subject string.- Returns:
- the newly created Subject field.
-
sender
Creates a Sender field for the specified mailbox address.- Parameters:
mailbox- address to be included in the field.- Returns:
- the newly created Sender field.
-
from
Creates a From field for the specified mailbox address.- Parameters:
mailbox- address to be included in the field.- Returns:
- the newly created From field.
-
from
Creates a From field for the specified mailbox addresses.- Parameters:
mailboxes- addresses to be included in the field.- Returns:
- the newly created From field.
-
from
Creates a From field for the specified mailbox addresses.- Parameters:
mailboxes- addresses to be included in the field.- Returns:
- the newly created From field.
-
to
Creates a To field for the specified mailbox or group address.- Parameters:
address- mailbox or group address to be included in the field.- Returns:
- the newly created To field.
-
to
Creates a To field for the specified mailbox or group addresses.- Parameters:
addresses- mailbox or group addresses to be included in the field.- Returns:
- the newly created To field.
-
to
Creates a To field for the specified mailbox or group addresses.- Parameters:
addresses- mailbox or group addresses to be included in the field.- Returns:
- the newly created To field.
-
cc
Creates a Cc field for the specified mailbox or group address.- Parameters:
address- mailbox or group address to be included in the field.- Returns:
- the newly created Cc field.
-
cc
Creates a Cc field for the specified mailbox or group addresses.- Parameters:
addresses- mailbox or group addresses to be included in the field.- Returns:
- the newly created Cc field.
-
cc
Creates a Cc field for the specified mailbox or group addresses.- Parameters:
addresses- mailbox or group addresses to be included in the field.- Returns:
- the newly created Cc field.
-
bcc
Creates a Bcc field for the specified mailbox or group address.- Parameters:
address- mailbox or group address to be included in the field.- Returns:
- the newly created Bcc field.
-
bcc
Creates a Bcc field for the specified mailbox or group addresses.- Parameters:
addresses- mailbox or group addresses to be included in the field.- Returns:
- the newly created Bcc field.
-
bcc
Creates a Bcc field for the specified mailbox or group addresses.- Parameters:
addresses- mailbox or group addresses to be included in the field.- Returns:
- the newly created Bcc field.
-
replyTo
Creates a Reply-To field for the specified mailbox or group address.- Parameters:
address- mailbox or group address to be included in the field.- Returns:
- the newly created Reply-To field.
-
replyTo
Creates a Reply-To field for the specified mailbox or group addresses.- Parameters:
addresses- mailbox or group addresses to be included in the field.- Returns:
- the newly created Reply-To field.
-
replyTo
Creates a Reply-To field for the specified mailbox or group addresses.- Parameters:
addresses- mailbox or group addresses to be included in the field.- Returns:
- the newly created Reply-To field.
-
mailbox
Creates a mailbox field from the specified field name and mailbox address. Valid field names areSenderandResent-Sender.- Parameters:
fieldName- the name of the mailbox field (SenderorResent-Sender).mailbox- mailbox address for the field value.- Returns:
- the newly created mailbox field.
-
mailboxList
Creates a mailbox-list field from the specified field name and mailbox addresses. Valid field names areFromandResent-From.- Parameters:
fieldName- the name of the mailbox field (FromorResent-From).mailboxes- mailbox addresses for the field value.- Returns:
- the newly created mailbox-list field.
-
addressList
Creates an address-list field from the specified field name and mailbox or group addresses. Valid field names areTo,Cc,Bcc,Reply-To,Resent-To,Resent-CcandResent-Bcc.- Parameters:
fieldName- the name of the mailbox field (To,Cc,Bcc,Reply-To,Resent-To,Resent-CcorResent-Bcc).addresses- mailbox or group addresses for the field value.- Returns:
- the newly created address-list field.
-
date0
-
mailbox0
-
mailboxList0
-
addressList0
private static AddressListField addressList0(String fieldName, Iterable<? extends Address> addresses) -
checkValidFieldName
-
isValidMimeType
-
isValidDispositionType
-
parse
private static <F extends ParsedField> F parse(FieldParser<F> parser, String fieldName, String fieldBody) -
encodeAddresses
-