Class Content

  • All Implemented Interfaces:
    Serializable, Cloneable

    public class Content
    extends Object
    implements Serializable, Cloneable

    Represents textual data, plus an optional character set specification.

    By default, the text must be 7-bit ASCII, due to the constraints of the SMTP protocol. If the text must contain any other characters, then you must also specify a character set. Examples include UTF-8, ISO-8859-1, and Shift_JIS.

    See Also:
    Serialized Form
    • Constructor Detail

      • Content

        public Content()
        Default constructor for Content object. Callers should use the setter or fluent setter (with...) methods to initialize the object after creating it.
      • Content

        public Content​(String data)
        Constructs a new Content object. Callers should use the setter or fluent setter (with...) methods to initialize any additional object members.
        Parameters:
        data - The textual data of the content.
    • Method Detail

      • setData

        public void setData​(String data)

        The textual data of the content.

        Parameters:
        data - The textual data of the content.
      • getData

        public String getData()

        The textual data of the content.

        Returns:
        The textual data of the content.
      • withData

        public Content withData​(String data)

        The textual data of the content.

        Parameters:
        data - The textual data of the content.
        Returns:
        Returns a reference to this object so that method calls can be chained together.
      • setCharset

        public void setCharset​(String charset)

        The character set of the content.

        Parameters:
        charset - The character set of the content.
      • getCharset

        public String getCharset()

        The character set of the content.

        Returns:
        The character set of the content.
      • withCharset

        public Content withCharset​(String charset)

        The character set of the content.

        Parameters:
        charset - The character set of the content.
        Returns:
        Returns a reference to this object so that method calls can be chained together.
      • toString

        public String toString()
        Returns a string representation of this object; useful for testing and debugging.
        Overrides:
        toString in class Object
        Returns:
        A string representation of this object.
        See Also:
        Object.toString()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object