Class BodyPartBuilder

    • Constructor Detail

      • BodyPartBuilder

        public BodyPartBuilder()
    • Method Detail

      • setField

        public BodyPartBuilder setField​(Field field)
        Description copied from class: AbstractEntityBuilder
        Sets or replaces a field. This method is useful for header fields such as Subject or Message-ID that should not occur more than once in a message. If this builder does not already contain a header field of the same name as the given field then it is added to the end of the list of fields (same behavior as AbstractEntityBuilder.addField(org.apache.james.mime4j.stream.Field)). Otherwise the first occurrence of a field with the same name is replaced by the given field and all further occurrences are removed.
        Overrides:
        setField in class AbstractEntityBuilder
        Parameters:
        field - the field to set.
      • setContentDisposition

        public BodyPartBuilder setContentDisposition​(java.lang.String dispositionType)
        Description copied from class: AbstractEntityBuilder
        Sets content disposition of this message to the specified disposition type. No filename, size or date parameters are included in the content disposition.
        Overrides:
        setContentDisposition in class AbstractEntityBuilder
        Parameters:
        dispositionType - disposition type value (usually inline or attachment).
      • setContentDisposition

        public BodyPartBuilder setContentDisposition​(java.lang.String dispositionType,
                                                     java.lang.String filename)
        Description copied from class: AbstractEntityBuilder
        Sets content disposition of this message to the specified disposition type and filename. No size or date parameters are included in the content disposition.
        Overrides:
        setContentDisposition in class AbstractEntityBuilder
        Parameters:
        dispositionType - disposition type value (usually inline or attachment).
        filename - filename parameter value or null if the parameter should not be included.
      • setContentDisposition

        public BodyPartBuilder setContentDisposition​(java.lang.String dispositionType,
                                                     java.lang.String filename,
                                                     long size)
        Description copied from class: AbstractEntityBuilder
        Sets content disposition of this message to the specified values. No date parameters are included in the content disposition.
        Overrides:
        setContentDisposition in class AbstractEntityBuilder
        Parameters:
        dispositionType - disposition type value (usually inline or attachment).
        filename - filename parameter value or null if the parameter should not be included.
        size - size parameter value or -1 if the parameter should not be included.
      • setContentDisposition

        public BodyPartBuilder setContentDisposition​(java.lang.String dispositionType,
                                                     java.lang.String filename,
                                                     long size,
                                                     java.util.Date creationDate,
                                                     java.util.Date modificationDate,
                                                     java.util.Date readDate)
        Description copied from class: AbstractEntityBuilder
        Sets content disposition of this message to the specified values.
        Overrides:
        setContentDisposition in class AbstractEntityBuilder
        Parameters:
        dispositionType - disposition type value (usually inline or attachment).
        filename - filename parameter value or null if the parameter should not be included.
        size - size parameter value or -1 if the parameter should not be included.
        creationDate - creation-date parameter value or null if the parameter should not be included.
        modificationDate - modification-date parameter value or null if the parameter should not be included.
        readDate - read-date parameter value or null if the parameter should not be included.
      • setBody

        public BodyPartBuilder setBody​(java.lang.String text,
                                       java.nio.charset.Charset charset)
                                throws java.io.IOException
        Sets text of this message with the charset.
        Parameters:
        text - the text.
        charset - the charset of the text.
        Throws:
        java.io.IOException
      • setBody

        public BodyPartBuilder setBody​(java.lang.String text,
                                       java.lang.String subtype,
                                       java.nio.charset.Charset charset)
                                throws java.io.IOException
        Sets text of this message with the given MIME subtype and charset.
        Parameters:
        text - the text.
        charset - the charset of the text.
        subtype - the text subtype (e.g. "plain", "html" or "xml").
        Throws:
        java.io.IOException
      • setBody

        public BodyPartBuilder setBody​(byte[] bin,
                                       java.lang.String mimeType)
                                throws java.io.IOException
        Sets binary content of this message with the given MIME type.
        Parameters:
        bin - the body.
        mimeType - the MIME media type of the specified body ("type/subtype").
        Throws:
        java.io.IOException