Class MimeUtil
java.lang.Object
org.apache.james.mime4j.util.MimeUtil
A utility class, which provides some MIME related application logic.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static intstatic final StringThe7bitencoding.static final StringThe8bitencoding.static final StringThebase64encoding.static final StringThebinaryencoding.static final StringThequoted-printableencoding.private static final intprivate static final Randomstatic final DateTimeFormatter -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringCreates a new unique message boundary string that can be used as boundary parameter for the Content-Type header field of a message.static StringcreateUniqueMessageId(String hostName) Creates a new unique message identifier that can be used in message header field such as Message-ID or In-Reply-To.static StringSplits the specified string into a multiple-line representation with lines no longer than 76 characters (because the line might contain encoded words; see RFC 2047 section 2).static StringformatDate(Date date, TimeZone zone) Formats the specified date into a RFC 822 date-time string.private static intindexOfWsp(String s, int fromIndex) static booleanisBase64Encoding(String pTransferEncoding) Returns, whether the given transfer-encoding is "base64".static booleanReturns true, if the given MIME type is that of a message.static booleanisMultipart(String pMimeType) Return true, if the given MIME type indicates a multipart entity.static booleanisQuotedPrintableEncoded(String pTransferEncoding) Returns, whether the given transfer-encoding is "quoted-printable".static booleanisSameMimeType(String pType1, String pType2) Returns, whether the given two MIME types are identical.private static intstatic StringUnfold a multiple-line representation into a single line.private static Stringstatic StringunscrambleHeaderValue(String headerValue) Unfold and decode header valueprivate static ZoneId
-
Field Details
-
ENC_QUOTED_PRINTABLE
-
ENC_BINARY
-
ENC_BASE64
-
ENC_8BIT
-
ENC_7BIT
-
random
-
counter
private static int counter -
INITIAL_YEAR
private static final int INITIAL_YEAR- See Also:
-
RFC822_DATE_FORMAT
-
-
Constructor Details
-
MimeUtil
private MimeUtil()
-
-
Method Details
-
isSameMimeType
-
isMessage
Returns true, if the given MIME type is that of a message. -
isMultipart
Return true, if the given MIME type indicates a multipart entity. -
isBase64Encoding
Returns, whether the given transfer-encoding is "base64". -
isQuotedPrintableEncoded
Returns, whether the given transfer-encoding is "quoted-printable". -
createUniqueBoundary
Creates a new unique message boundary string that can be used as boundary parameter for the Content-Type header field of a message.- Returns:
- a new unique message boundary string.
-
createUniqueMessageId
Creates a new unique message identifier that can be used in message header field such as Message-ID or In-Reply-To. If the given host name is notnullit will be used as suffix for the message ID (following an at sign). The resulting string is enclosed in angle brackets (< and >);- Parameters:
hostName- host name to be included in the message ID ornullif no host name should be included.- Returns:
- a new unique message identifier.
-
formatDate
-
zone
-
fold
Splits the specified string into a multiple-line representation with lines no longer than 76 characters (because the line might contain encoded words; see RFC 2047 section 2). If the string contains non-whitespace sequences longer than 76 characters a line break is inserted at the whitespace character following the sequence resulting in a line longer than 76 characters.- Parameters:
s- string to split.usedCharacters- number of characters already used up. Usually the number of characters for header field name plus colon and one space.- Returns:
- a multiple-line representation of the given string.
-
unfold
-
unscrambleHeaderValue
-
unfold0
-
indexOfWsp
-
nextCounterValue
private static int nextCounterValue() -
monthOfYear
-
dayOfWeek
-