Interface Entity

All Superinterfaces:
Disposable
All Known Subinterfaces:
Message
All Known Implementing Classes:
AbstractEntity, AbstractMessage, BodyPart, MessageImpl

public interface Entity extends Disposable
A MIME entity. An entity has a header and a body (as defined in RFC 2045).
  • Method Details

    • getParent

      Entity getParent()
      Gets the parent entity of this entity. Returns null if this is the root entity.
      Returns:
      the parent or null.
    • setParent

      void setParent(Entity parent)
      Sets the parent entity of this entity.
      Parameters:
      parent - the parent entity or null if this will be the root entity.
    • getHeader

      Header getHeader()
      Gets the entity header.
      Returns:
      the header.
    • setHeader

      void setHeader(Header header)
      Sets the entity header.
      Parameters:
      header - the header.
    • getBody

      Body getBody()
      Gets the body of this entity.
      Returns:
      the body,
    • setBody

      void setBody(Body body)
      Sets the body of this entity.
      Parameters:
      body - the body.
      Throws:
      IllegalStateException - if the body has already been set.
    • removeBody

      Body removeBody()
      Removes and returns the body of this entity. The removed body may be attached to another entity. If it is no longer needed it should be disposed of.
      Returns:
      the removed body or null if no body was set.
    • isMultipart

      boolean isMultipart()
      Determines if the MIME type of this Entity is multipart/*. Since multipart-entities must have a boundary parameter in the Content-Type field this method returns false if no boundary exists.
      Returns:
      true on match, false otherwise.
    • getMimeType

      String getMimeType()
      Determines the MIME type of this Entity. The MIME type is derived by looking at the parent's Content-Type field if no Content-Type field is set for this Entity.
      Returns:
      the MIME type.
    • getCharset

      String getCharset()
      Determines the MIME character set encoding of this Entity.
      Returns:
      the MIME character set encoding.
    • getContentTransferEncoding

      String getContentTransferEncoding()
      Determines the transfer encoding of this Entity.
      Returns:
      the transfer encoding.
    • getDispositionType

      String getDispositionType()
      Return the disposition type of the content disposition of this Entity.
      Returns:
      the disposition type or null if no disposition type has been set.
    • getFilename

      String getFilename()
      Returns the filename parameter of the content disposition of this Entity.
      Returns:
      the filename parameter of the content disposition or null if the filename has not been set.