Top Description Fields Constructors Methods
io.netty.handler.codec.base64

public Class Base64Encoder

extends MessageToMessageEncoder<ByteBuf>
Class Inheritance
Annotations
@Sharable
Imports
io.netty.buffer.ByteBuf, io.netty.channel.ChannelHandler.Sharable, .ChannelHandlerContext, .ChannelPipeline, io.netty.handler.codec.DelimiterBasedFrameDecoder, .Delimiters, .MessageToMessageEncoder, io.netty.util.internal.ObjectUtil, java.util.List

Encodes a ByteBuf into a Base64-encoded ByteBuf. A typical setup for TCP/IP would be:
ChannelPipeline pipeline = ...;

// Decoders
pipeline.addLast("frameDecoder", new DelimiterBasedFrameDecoder(80, Delimiters#nulDelimiter()));
pipeline.addLast("base64Decoder", new Base64Decoder());

// Encoder
pipeline.addLast("base64Encoder", new Base64Encoder());

Field Summary

Modifier and TypeField and Description
private final boolean
private final Base64Dialect

Constructor Summary

AccessConstructor and Description
public
public
Base64Encoder(boolean breakLines)

public
Base64Encoder(boolean breakLines, Base64Dialect dialect)

Method Summary

Modifier and TypeMethod and Description
protected void
encode(ChannelHandlerContext ctx, ByteBuf
the message to encode to an other one
msg
,
List<Object>
the List into which the encoded msg should be added needs to do some kind of aggregation
out
)

Implements abstract io.netty.handler.codec.MessageToMessageEncoder.encode.

Encode from one message to an other.
Inherited from io.netty.handler.codec.MessageToMessageEncoder:
acceptOutboundMessagewrite

Field Detail

breakLinesback to summary
private final boolean breakLines
dialectback to summary
private final Base64Dialect dialect

Constructor Detail

Base64Encoderback to summary
public Base64Encoder()
Base64Encoderback to summary
public Base64Encoder(boolean breakLines)
Base64Encoderback to summary
public Base64Encoder(boolean breakLines, Base64Dialect dialect)

Method Detail

encodeback to summary
protected void encode(ChannelHandlerContext ctx, ByteBuf msg, List<Object> out) throws Exception

Implements abstract io.netty.handler.codec.MessageToMessageEncoder.encode.

Doc from io.netty.handler.codec.MessageToMessageEncoder.encode.

Encode from one message to an other. This method will be called for each written message that can be handled by this encoder.

Parameters
ctx:ChannelHandlerContext

the ChannelHandlerContext which this MessageToMessageEncoder belongs to

msg:ByteBuf

the message to encode to an other one

out:List<Object>

the List into which the encoded msg should be added needs to do some kind of aggregation

Annotations
@Override
Exceptions
Exception:
is thrown if an error occurs