Package org.apache.james.mime4j.stream
Class BasicBodyDescriptor
- java.lang.Object
-
- org.apache.james.mime4j.stream.BasicBodyDescriptor
-
- All Implemented Interfaces:
BodyDescriptor
,ContentDescriptor
class BasicBodyDescriptor extends java.lang.Object implements BodyDescriptor
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
boundary
private java.lang.String
charset
private long
contentLength
private java.lang.String
mediaType
private java.lang.String
mimeType
private java.lang.String
subType
private java.lang.String
transferEncoding
-
Constructor Summary
Constructors Constructor Description BasicBodyDescriptor(java.lang.String mimeType, java.lang.String mediaType, java.lang.String subType, java.lang.String boundary, java.lang.String charset, java.lang.String transferEncoding, long contentLength)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getBoundary()
Returns the body descriptors boundary.java.lang.String
getCharset()
The body descriptors character set, defaulted appropriately for the MIME type.long
getContentLength()
Returns the body descriptors content-length.java.lang.String
getMediaType()
Gets the defaulted MIME media type for this content.java.lang.String
getMimeType()
Returns the body descriptors MIME type.java.lang.String
getSubType()
Gets the defaulted MIME sub type for this content.java.lang.String
getTransferEncoding()
Returns the body descriptors transfer encoding.java.lang.String
toString()
-
-
-
Field Detail
-
mimeType
private final java.lang.String mimeType
-
mediaType
private final java.lang.String mediaType
-
subType
private final java.lang.String subType
-
boundary
private final java.lang.String boundary
-
charset
private final java.lang.String charset
-
transferEncoding
private final java.lang.String transferEncoding
-
contentLength
private final long contentLength
-
-
Method Detail
-
getMimeType
public java.lang.String getMimeType()
Description copied from interface:ContentDescriptor
Returns the body descriptors MIME type.- Specified by:
getMimeType
in 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()
-
getMediaType
public java.lang.String getMediaType()
Description copied from interface:ContentDescriptor
Gets the defaulted MIME media type for this content. For exampleTEXT
,IMAGE
,MULTIPART
- Specified by:
getMediaType
in 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:ContentDescriptor
Gets the defaulted MIME sub type for this content.- Specified by:
getSubType
in interfaceContentDescriptor
- Returns:
- the MIME media type when content-type is specified,
otherwise the correct default (
PLAIN
) - See Also:
ContentDescriptor.getMimeType()
-
getBoundary
public java.lang.String getBoundary()
Description copied from interface:BodyDescriptor
Returns the body descriptors boundary.- Specified by:
getBoundary
in 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:ContentDescriptor
The body descriptors character set, defaulted appropriately for the MIME type.
For
TEXT
types, this will be defaulted tous-ascii
. For other types, when the charset parameter is missing this property will be null.- Specified by:
getCharset
in interfaceContentDescriptor
- Returns:
- Character set, which has been parsed from the
content-type definition. Not null for
TEXT
types, when unset will be set to defaultus-ascii
. For other types, when unset, null will be returned.
-
getTransferEncoding
public java.lang.String getTransferEncoding()
Description copied from interface:ContentDescriptor
Returns the body descriptors transfer encoding.- Specified by:
getTransferEncoding
in 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:ContentDescriptor
Returns the body descriptors content-length.- Specified by:
getContentLength
in interfaceContentDescriptor
- Returns:
- Content length, if known, or -1, to indicate the absence of a content-length header.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-