Package com.opencloud.sentinel.util
Class MessageBody
- java.lang.Object
-
- com.opencloud.sentinel.util.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)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidencode(java.io.DataOutput out, com.opencloud.rhino.cmp.codecs.EncoderUtils utils)booleanequals(java.lang.Object o)byte[]getContent()java.lang.StringgetContentAsString()Best effort at getting the content as a string, using the specified encoding from the content type.java.lang.StringgetContentDisposition()java.lang.StringgetContentType()javax.mail.internet.ContentTypegetContentTypeObject()booleanhasContentDisposition()inthashCode()booleanmatchesContentType(java.lang.String type)Matches the content type and sub-type, parameters are ignoredvoidsetContent(byte[] content)voidsetContentDisposition(java.lang.String contentDisposition)voidsetContentType(java.lang.String contentType)voidsetContentType(javax.mail.internet.ContentType contentType)java.lang.StringtoString()
-
-
-
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:
encodein interfacecom.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:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-