@ChannelHandler.Sharable public class Base64Encoder extends MessageToMessageEncoder<ByteBuf>
ByteBuf
编码为Base64编码的ByteBuf
。
TCP / IP的典型设置是:
ChannelPipeline
pipeline = ...;
// Decoders
pipeline.addLast("frameDecoder", new DelimiterBasedFrameDecoder
(80, Delimiters.nulDelimiter()
));
pipeline.addLast("base64Decoder", new Base64Decoder
());
// Encoder
pipeline.addLast("base64Encoder", new Base64Encoder
());
ChannelHandler.Sharable
Constructor and Description |
---|
Base64Encoder() |
Base64Encoder(boolean breakLines) |
Base64Encoder(boolean breakLines, Base64Dialect dialect) |
Modifier and Type | Method and Description |
---|---|
protected void |
encode(ChannelHandlerContext ctx, ByteBuf msg, java.util.List<java.lang.Object> out)
从一条消息编码到另一条消息。
|
acceptOutboundMessage, write
bind, close, connect, deregister, disconnect, flush, read
ensureNotSharable, exceptionCaught, handlerAdded, handlerRemoved, isSharable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
exceptionCaught, handlerAdded, handlerRemoved
public Base64Encoder()
public Base64Encoder(boolean breakLines)
public Base64Encoder(boolean breakLines, Base64Dialect dialect)
protected void encode(ChannelHandlerContext ctx, ByteBuf msg, java.util.List<java.lang.Object> out) throws java.lang.Exception
MessageToMessageEncoder
encode
在课堂
MessageToMessageEncoder<ByteBuf>
ctx
- 这是MessageToMessageEncoder
所属的ChannelHandlerContext
msg
- 要编码到另一个的消息
out
- 应该添加编码味精的
List
需要做某种聚合
java.lang.Exception
- 发生错误时抛出
Copyright © 2008–2018 The Netty Project. All rights reserved.