Class MessageBody

  • All Implemented Interfaces:
    com.opencloud.rhino.cmp.Encodable

    public class MessageBody
    extends java.lang.Object
    implements com.opencloud.rhino.cmp.Encodable
    • Constructor Summary

      Constructors 
      Constructor Description
      MessageBody​(java.io.DataInput in, java.lang.ClassLoader cl, com.opencloud.rhino.cmp.codecs.DecoderUtils utils)  
      MessageBody​(java.lang.String contentType, byte[] content)  
      MessageBody​(javax.mail.internet.ContentType contentType, byte[] content)  
    • Constructor Detail

      • MessageBody

        public MessageBody​(@Nonnull
                           java.lang.String contentType,
                           @Nonnull
                           byte[] content)
                    throws java.io.IOException
        Throws:
        java.io.IOException
      • MessageBody

        public MessageBody​(@Nonnull
                           javax.mail.internet.ContentType contentType,
                           @Nonnull
                           byte[] content)
      • MessageBody

        public MessageBody​(java.io.DataInput in,
                           java.lang.ClassLoader cl,
                           com.opencloud.rhino.cmp.codecs.DecoderUtils utils)
                    throws java.io.IOException
        Throws:
        java.io.IOException
    • Method Detail

      • encode

        public void encode​(java.io.DataOutput out,
                           com.opencloud.rhino.cmp.codecs.EncoderUtils utils)
                    throws java.io.IOException
        Specified by:
        encode in interface com.opencloud.rhino.cmp.Encodable
        Throws:
        java.io.IOException
      • getContentType

        public java.lang.String getContentType()
      • getContentTypeObject

        public javax.mail.internet.ContentType getContentTypeObject()
      • setContentType

        public void setContentType​(@Nonnull
                                   java.lang.String contentType)
                            throws java.io.IOException
        Throws:
        java.io.IOException
      • setContentType

        public void setContentType​(@Nonnull
                                   javax.mail.internet.ContentType contentType)
      • getContentDisposition

        public java.lang.String getContentDisposition()
      • setContentDisposition

        public void setContentDisposition​(java.lang.String contentDisposition)
      • hasContentDisposition

        public boolean hasContentDisposition()
      • getContent

        public byte[] getContent()
      • getContentAsString

        public java.lang.String getContentAsString()
        Best effort at getting the content as a string, using the specified encoding from the content type. If the encoding is unknown or not specified, assume UTF-8. Invalid UTF-8 characters will appear as "�" (U+FFFD).
      • setContent

        public void setContent​(@Nonnull
                               byte[] content)
      • matchesContentType

        public boolean matchesContentType​(java.lang.String type)
        Matches the content type and sub-type, parameters are ignored
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object