Interface Multipart

  • All Superinterfaces:
    Body, Disposable
    All Known Implementing Classes:
    AbstractMultipart, MultipartImpl

    public interface Multipart
    extends Body
    A MIME multipart body (as defined in RFC 2045). A multipart body has a ordered list of body parts. The multipart body also has a preamble and epilogue. The preamble consists of whatever characters appear before the first body part while the epilogue consists of whatever characters come after the last body part.
    • Method Detail

      • getSubType

        String getSubType()
        Gets the multipart sub-type. E.g. alternative (the default) or parallel. See RFC 2045 for common sub-types and their meaning.
        Returns:
        the multipart sub-type.
      • getCount

        int getCount()
        Returns the number of body parts.
        Returns:
        number of Entity objects.
      • getBodyParts

        List<Entity> getBodyParts()
        Gets the list of body parts. The list is immutable.
        Returns:
        the list of Entity objects.
      • setBodyParts

        void setBodyParts​(List<Entity> bodyParts)
        Sets the list of body parts.
        Parameters:
        bodyParts - the new list of Entity objects.
      • addBodyPart

        void addBodyPart​(Entity bodyPart)
        Adds a body part to the end of the list of body parts.
        Parameters:
        bodyPart - the body part.
      • addBodyPart

        void addBodyPart​(Entity bodyPart,
                         int index)
        Inserts a body part at the specified position in the list of body parts.
        Parameters:
        bodyPart - the body part.
        index - index at which the specified body part is to be inserted.
        Throws:
        IndexOutOfBoundsException - if the index is out of range (index < 0 || index > getCount()).
      • removeBodyPart

        Entity removeBodyPart​(int index)
        Removes the body part at the specified position in the list of body parts.
        Parameters:
        index - index of the body part to be removed.
        Returns:
        the removed body part.
        Throws:
        IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= getCount()).
      • replaceBodyPart

        Entity replaceBodyPart​(Entity bodyPart,
                               int index)
        Replaces the body part at the specified position in the list of body parts with the specified body part.
        Parameters:
        bodyPart - body part to be stored at the specified position.
        index - index of body part to replace.
        Returns:
        the replaced body part.
        Throws:
        IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= getCount()).
      • getPreamble

        String getPreamble()
        Gets the preamble or null if the message has no preamble.
        Returns:
        the preamble.
      • setPreamble

        void setPreamble​(String preamble)
        Sets the preamble with a value or null to remove the preamble.
        Parameters:
        preamble - the preamble.
      • getEpilogue

        String getEpilogue()
        Gets the epilogue or null if the message has no epilogue
        Returns:
        the epilogue.
      • setEpilogue

        void setEpilogue​(String epilogue)
        Sets the epilogue value, or remove it if the value passed is null.
        Parameters:
        epilogue - the epilogue.