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 void
encode(java.io.DataOutput out, com.opencloud.rhino.cmp.codecs.EncoderUtils utils)
boolean
equals(java.lang.Object o)
byte[]
getContent()
java.lang.String
getContentAsString()
Best effort at getting the content as a string, using the specified encoding from the content type.java.lang.String
getContentDisposition()
java.lang.String
getContentType()
javax.mail.internet.ContentType
getContentTypeObject()
boolean
hasContentDisposition()
int
hashCode()
boolean
matchesContentType(java.lang.String type)
Matches the content type and sub-type, parameters are ignoredvoid
setContent(byte[] content)
void
setContentDisposition(java.lang.String contentDisposition)
void
setContentType(java.lang.String contentType)
void
setContentType(javax.mail.internet.ContentType contentType)
java.lang.String
toString()
-
-
-
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 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:
toString
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-