Package org.apache.james.mime4j.message
Class MaximalBodyDescriptor
- java.lang.Object
-
- org.apache.james.mime4j.message.MaximalBodyDescriptor
-
- All Implemented Interfaces:
BodyDescriptor,ContentDescriptor
public class MaximalBodyDescriptor extends java.lang.Object implements BodyDescriptor
ExtendedBodyDescriptorimplementation with complete content details.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Stringboundaryprivate java.lang.Stringcharsetprivate static java.lang.StringCONTENT_DESCRIPTIONprivate static java.lang.StringCONTENT_DISPOSITIONprivate static java.lang.StringCONTENT_IDprivate static java.lang.StringCONTENT_LANGUAGEprivate static java.lang.StringCONTENT_LENGTHprivate static java.lang.StringCONTENT_LOCATIONprivate static java.lang.StringCONTENT_MD5private static java.lang.StringCONTENT_TRANSFER_ENCODINGprivate static java.lang.StringCONTENT_TYPEprivate java.util.Map<java.lang.String,ParsedField>fieldsprivate java.lang.StringmediaTypeprivate static java.lang.StringMIME_VERSIONprivate java.lang.StringmimeTypeprivate java.lang.StringsubType
-
Constructor Summary
Constructors Constructor Description MaximalBodyDescriptor(java.lang.String mimeType, java.lang.String mediaType, java.lang.String subType, java.lang.String boundary, java.lang.String charset, java.util.Map<java.lang.String,ParsedField> fields)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetBoundary()Returns the body descriptors boundary.java.lang.StringgetCharset()The body descriptors character set, defaulted appropriately for the MIME type.java.lang.StringgetContentDescription()Gets the value of the RFCContent-Descriptionheader.java.util.DategetContentDispositionCreationDate()Gets thecreation-dateparameter value of thecontent-dispositionfield.java.lang.StringgetContentDispositionFilename()Gets thefilenameparameter value of thecontent-dispositionfield.java.util.DategetContentDispositionModificationDate()Gets themodification-dateparameter value of thecontent-dispositionfield.java.util.Map<java.lang.String,java.lang.String>getContentDispositionParameters()Gets the parameters of thecontent-dispositionfield.java.util.DategetContentDispositionReadDate()Gets theread-dateparameter value of thecontent-dispositionfield.longgetContentDispositionSize()Gets thesizeparameter value of thecontent-dispositionfield.java.lang.StringgetContentDispositionType()Gets the disposition type of thecontent-dispositionfield.java.lang.StringgetContentId()Gets the value of the RFCContent-IDheader.java.util.List<java.lang.String>getContentLanguage()Get thecontent-languageheader values.longgetContentLength()Returns the body descriptors content-length.java.lang.StringgetContentLocation()Get thecontent-locationheader value.java.lang.StringgetContentMD5Raw()Gets the raw, Base64 encoded value of theContent-MD5field.java.util.Map<java.lang.String,java.lang.String>getContentTypeParameters()java.lang.StringgetMediaType()Gets the defaulted MIME media type for this content.intgetMimeMajorVersion()Gets the MIME major version as specified by theMIME-Versionheader.intgetMimeMinorVersion()Gets the MIME minor version as specified by theMIME-Versionheader.java.lang.StringgetMimeType()Returns the body descriptors MIME type.java.lang.StringgetSubType()Gets the defaulted MIME sub type for this content.java.lang.StringgetTransferEncoding()Returns the body descriptors transfer encoding.java.lang.StringtoString()
-
-
-
Field Detail
-
CONTENT_TYPE
private static final java.lang.String CONTENT_TYPE
-
CONTENT_LENGTH
private static final java.lang.String CONTENT_LENGTH
-
CONTENT_TRANSFER_ENCODING
private static final java.lang.String CONTENT_TRANSFER_ENCODING
-
CONTENT_DISPOSITION
private static final java.lang.String CONTENT_DISPOSITION
-
CONTENT_ID
private static final java.lang.String CONTENT_ID
-
CONTENT_MD5
private static final java.lang.String CONTENT_MD5
-
CONTENT_DESCRIPTION
private static final java.lang.String CONTENT_DESCRIPTION
-
CONTENT_LANGUAGE
private static final java.lang.String CONTENT_LANGUAGE
-
CONTENT_LOCATION
private static final java.lang.String CONTENT_LOCATION
-
MIME_VERSION
private static final java.lang.String MIME_VERSION
-
mediaType
private final java.lang.String mediaType
-
subType
private final java.lang.String subType
-
mimeType
private final java.lang.String mimeType
-
boundary
private final java.lang.String boundary
-
charset
private final java.lang.String charset
-
fields
private final java.util.Map<java.lang.String,ParsedField> fields
-
-
Constructor Detail
-
MaximalBodyDescriptor
MaximalBodyDescriptor(java.lang.String mimeType, java.lang.String mediaType, java.lang.String subType, java.lang.String boundary, java.lang.String charset, java.util.Map<java.lang.String,ParsedField> fields)
-
-
Method Detail
-
getMimeType
public java.lang.String getMimeType()
Description copied from interface:ContentDescriptorReturns the body descriptors MIME type.- Specified by:
getMimeTypein interfaceContentDescriptor- Returns:
- The MIME type, which has been parsed from the content-type definition. Must not be null, but "text/plain", if no content-type was specified.
- See Also:
ContentDescriptor.getMediaType(),ContentDescriptor.getSubType()
-
getBoundary
public java.lang.String getBoundary()
Description copied from interface:BodyDescriptorReturns the body descriptors boundary.- Specified by:
getBoundaryin interfaceBodyDescriptor- Returns:
- Boundary string, if known, or null. The latter may be the case, in particular, if the body is no multipart entity.
-
getCharset
public java.lang.String getCharset()
Description copied from interface:ContentDescriptorThe body descriptors character set, defaulted appropriately for the MIME type.
For
TEXTtypes, this will be defaulted tous-ascii. For other types, when the charset parameter is missing this property will be null.- Specified by:
getCharsetin interfaceContentDescriptor- Returns:
- Character set, which has been parsed from the
content-type definition. Not null for
TEXTtypes, when unset will be set to defaultus-ascii. For other types, when unset, null will be returned.
-
getMediaType
public java.lang.String getMediaType()
Description copied from interface:ContentDescriptorGets the defaulted MIME media type for this content. For exampleTEXT,IMAGE,MULTIPART- Specified by:
getMediaTypein interfaceContentDescriptor- Returns:
- the MIME media type when content-type specified,
otherwise the correct default (
TEXT) - See Also:
ContentDescriptor.getMimeType()
-
getSubType
public java.lang.String getSubType()
Description copied from interface:ContentDescriptorGets the defaulted MIME sub type for this content.- Specified by:
getSubTypein interfaceContentDescriptor- Returns:
- the MIME media type when content-type is specified,
otherwise the correct default (
PLAIN) - See Also:
ContentDescriptor.getMimeType()
-
getContentTypeParameters
public java.util.Map<java.lang.String,java.lang.String> getContentTypeParameters()
-
getTransferEncoding
public java.lang.String getTransferEncoding()
Description copied from interface:ContentDescriptorReturns the body descriptors transfer encoding.- Specified by:
getTransferEncodingin interfaceContentDescriptor- Returns:
- The transfer encoding. Must not be null, but "7bit", if no transfer-encoding was specified.
-
getContentLength
public long getContentLength()
Description copied from interface:ContentDescriptorReturns the body descriptors content-length.- Specified by:
getContentLengthin interfaceContentDescriptor- Returns:
- Content length, if known, or -1, to indicate the absence of a content-length header.
-
getMimeMajorVersion
public int getMimeMajorVersion()
Gets the MIME major version as specified by theMIME-Versionheader. Defaults to one.- Returns:
- positive integer
-
getMimeMinorVersion
public int getMimeMinorVersion()
Gets the MIME minor version as specified by theMIME-Versionheader. Defaults to zero.- Returns:
- positive integer
-
getContentDescription
public java.lang.String getContentDescription()
Gets the value of the RFCContent-Descriptionheader.- Returns:
- value of the
Content-Descriptionwhen present, null otherwise
-
getContentId
public java.lang.String getContentId()
Gets the value of the RFCContent-IDheader.- Returns:
- value of the
Content-IDwhen present, null otherwise
-
getContentDispositionType
public java.lang.String getContentDispositionType()
Gets the disposition type of thecontent-dispositionfield. The value is case insensitive and will be converted to lower case. See RFC2183.- Returns:
- content disposition type, or null when this has not been set
-
getContentDispositionParameters
public java.util.Map<java.lang.String,java.lang.String> getContentDispositionParameters()
Gets the parameters of thecontent-dispositionfield. See RFC2183.- Returns:
- parameter value strings indexed by parameter name strings, not null
-
getContentDispositionFilename
public java.lang.String getContentDispositionFilename()
- Returns:
- filename parameter value, or null when it is not present
-
getContentDispositionModificationDate
public java.util.Date getContentDispositionModificationDate()
- Returns:
- modification-date parameter value, or null when this is not present
-
getContentDispositionCreationDate
public java.util.Date getContentDispositionCreationDate()
- Returns:
- creation-date parameter value, or null when this is not present
-
getContentDispositionReadDate
public java.util.Date getContentDispositionReadDate()
- Returns:
- read-date parameter value, or null when this is not present
-
getContentDispositionSize
public long getContentDispositionSize()
- Returns:
- size parameter value, or -1 if this size has not been set
-
getContentLanguage
public java.util.List<java.lang.String> getContentLanguage()
Get thecontent-languageheader values. Each applicable language tag will be returned in order. See RFC4646 http://tools.ietf.org/html/rfc4646.- Returns:
- list of language tag Strings, or null if no header exists
-
getContentLocation
public java.lang.String getContentLocation()
Get thecontent-locationheader value. See RFC2557- Returns:
- the URL content-location or null if no header exists
-
getContentMD5Raw
public java.lang.String getContentMD5Raw()
Gets the raw, Base64 encoded value of theContent-MD5field. See RFC1864.- Returns:
- raw encoded content-md5 or null if no header exists
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-