public abstract class MessageContent extends Object
Modifier and Type | Method and Description |
---|---|
abstract float |
get8bitCharacterProportion()
Estimates the proportion of characters in this
MessageContent that are eight-bit. |
abstract Object |
getContent()
Gets the raw message content in a form that can be written to a Netty channel.
|
abstract String |
getContentAsString()
Gets the content interpreted as a UTF-8 string.
|
abstract Iterator<io.netty.buffer.ByteBuf> |
getContentChunkIterator(io.netty.buffer.ByteBufAllocator allocator)
Gets an iterator for chunks of content, suitable for use with the chunking SMTP extension.
|
abstract Object |
getDotStuffedContent()
Gets the message content with dot-stuffing applied in a form that can be written to a Netty channel.
|
abstract MessageContentEncoding |
getEncoding()
Gets the
MessageContentEncoding of the content, indicating whether it
contains eight-bit characters. |
static MessageContent |
of(io.netty.buffer.ByteBuf messageBuffer)
Creates a
MessageContent from a ByteBuf that might contain eight-bit characters. |
static MessageContent |
of(io.netty.buffer.ByteBuf messageBuffer,
MessageContentEncoding encoding)
|
static MessageContent |
of(com.google.common.io.ByteSource byteSource)
Creates a
MessageContent from a ByteSource that might contain eight-bit characters. |
static MessageContent |
of(com.google.common.io.ByteSource byteSource,
MessageContentEncoding encoding)
|
static MessageContent |
of(Supplier<InputStream> messageStream)
Creates a
MessageContent from an InputStream that might contain eight-bit characters. |
static MessageContent |
of(Supplier<InputStream> messageStream,
MessageContentEncoding encoding)
|
static MessageContent |
of(Supplier<InputStream> messageStream,
MessageContentEncoding encoding,
int size)
|
abstract OptionalInt |
size()
The size of the content, used to reject messages for servers that support the SIZE SMTP extension.
|
public static MessageContent of(io.netty.buffer.ByteBuf messageBuffer)
MessageContent
from a ByteBuf
that might contain eight-bit characters.public static MessageContent of(io.netty.buffer.ByteBuf messageBuffer, MessageContentEncoding encoding)
public static MessageContent of(Supplier<InputStream> messageStream)
MessageContent
from an InputStream
that might contain eight-bit characters.public static MessageContent of(Supplier<InputStream> messageStream, MessageContentEncoding encoding)
public static MessageContent of(Supplier<InputStream> messageStream, MessageContentEncoding encoding, int size)
public static MessageContent of(com.google.common.io.ByteSource byteSource)
MessageContent
from a ByteSource
that might contain eight-bit characters.public static MessageContent of(com.google.common.io.ByteSource byteSource, MessageContentEncoding encoding)
public abstract OptionalInt size()
public abstract Object getContent()
public abstract Iterator<io.netty.buffer.ByteBuf> getContentChunkIterator(io.netty.buffer.ByteBufAllocator allocator)
public abstract Object getDotStuffedContent()
public abstract MessageContentEncoding getEncoding()
MessageContentEncoding
of the content, indicating whether it
contains eight-bit characters.public abstract float get8bitCharacterProportion()
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.
public abstract String getContentAsString()
This is intended for debugging purposes only.
Copyright © 2018. All rights reserved.