Class BasicBodyDescriptor

java.lang.Object
org.apache.james.mime4j.stream.BasicBodyDescriptor
All Implemented Interfaces:
BodyDescriptor, ContentDescriptor

class BasicBodyDescriptor extends Object implements BodyDescriptor
  • Field Details

    • mimeType

      private final String mimeType
    • mediaType

      private final String mediaType
    • subType

      private final String subType
    • boundary

      private final String boundary
    • charset

      private final String charset
    • transferEncoding

      private final String transferEncoding
    • contentLength

      private final long contentLength
  • Constructor Details

  • Method Details

    • getMimeType

      public String getMimeType()
      Description copied from interface: ContentDescriptor
      Returns the body descriptors MIME type.
      Specified by:
      getMimeType in interface ContentDescriptor
      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:
    • getMediaType

      public String getMediaType()
      Description copied from interface: ContentDescriptor
      Gets the defaulted MIME media type for this content. For example TEXT, IMAGE, MULTIPART
      Specified by:
      getMediaType in interface ContentDescriptor
      Returns:
      the MIME media type when content-type specified, otherwise the correct default (TEXT)
      See Also:
    • getSubType

      public String getSubType()
      Description copied from interface: ContentDescriptor
      Gets the defaulted MIME sub type for this content.
      Specified by:
      getSubType in interface ContentDescriptor
      Returns:
      the MIME media type when content-type is specified, otherwise the correct default (PLAIN)
      See Also:
    • getBoundary

      public String getBoundary()
      Description copied from interface: BodyDescriptor
      Returns the body descriptors boundary.
      Specified by:
      getBoundary in interface BodyDescriptor
      Returns:
      Boundary string, if known, or null. The latter may be the case, in particular, if the body is no multipart entity.
    • getCharset

      public 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 to us-ascii. For other types, when the charset parameter is missing this property will be null.

      Specified by:
      getCharset in interface ContentDescriptor
      Returns:
      Character set, which has been parsed from the content-type definition. Not null for TEXT types, when unset will be set to default us-ascii. For other types, when unset, null will be returned.
    • getTransferEncoding

      public String getTransferEncoding()
      Description copied from interface: ContentDescriptor
      Returns the body descriptors transfer encoding.
      Specified by:
      getTransferEncoding in interface ContentDescriptor
      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 interface ContentDescriptor
      Returns:
      Content length, if known, or -1, to indicate the absence of a content-length header.
    • toString

      public String toString()
      Overrides:
      toString in class Object