public class ByteBufMessageContent extends MessageContent
MessageContent
implementation backed by a Netty ByteBuf
.Constructor and Description |
---|
ByteBufMessageContent(io.netty.buffer.ByteBuf buffer,
MessageContentEncoding encoding) |
Modifier and Type | Method and Description |
---|---|
float |
get8bitCharacterProportion()
Estimates the proportion of characters in this
MessageContent that are eight-bit. |
Object |
getContent()
Gets the raw message content in a form that can be written to a Netty channel.
|
String |
getContentAsString()
Gets the content interpreted as a UTF-8 string.
|
Iterator<io.netty.buffer.ByteBuf> |
getContentChunkIterator(io.netty.buffer.ByteBufAllocator allocator)
Returns a singleton iterator that just contains the wrapped
ByteBuf . |
Object |
getDotStuffedContent()
Gets the message content with dot-stuffing applied in a form that can be written to a Netty channel.
|
MessageContentEncoding |
getEncoding()
Gets the
MessageContentEncoding of the content, indicating whether it
contains eight-bit characters. |
OptionalInt |
size()
The size of the content, used to reject messages for servers that support the SIZE SMTP extension.
|
public ByteBufMessageContent(io.netty.buffer.ByteBuf buffer, MessageContentEncoding encoding)
public Object getContent()
MessageContent
getContent
in class MessageContent
public Iterator<io.netty.buffer.ByteBuf> getContentChunkIterator(io.netty.buffer.ByteBufAllocator allocator)
ByteBuf
.getContentChunkIterator
in class MessageContent
public Object getDotStuffedContent()
MessageContent
getDotStuffedContent
in class MessageContent
public MessageContentEncoding getEncoding()
MessageContent
MessageContentEncoding
of the content, indicating whether it
contains eight-bit characters.getEncoding
in class MessageContent
public OptionalInt size()
MessageContent
size
in class MessageContent
public float get8bitCharacterProportion()
MessageContent
MessageContent
that are eight-bit.
This proportion can be used to calculate whether a message would be more efficient if encoded as quoted-printable or base64.
get8bitCharacterProportion
in class MessageContent
public String getContentAsString()
MessageContent
This is intended for debugging purposes only.
getContentAsString
in class MessageContent
Copyright © 2018. All rights reserved.