@ChannelHandler.Sharable public class Base64Encoder extends MessageToMessageEncoder<ByteBuf,ByteBuf>
ByteBuf into a Base64-encoded ByteBuf.
A typical setup for TCP/IP would be:
ChannelPipelinepipeline = ...; // Decoders pipeline.addLast("frameDecoder", newDelimiterBasedFrameDecoder(80,Delimiters.nulDelimiter())); pipeline.addLast("base64Decoder", newBase64Decoder()); // Encoder pipeline.addLast("base64Encoder", newBase64Encoder());
ChannelHandler.Sharable| Constructor and Description |
|---|
Base64Encoder() |
Base64Encoder(boolean breakLines) |
Base64Encoder(boolean breakLines,
Base64Dialect dialect) |
| Modifier and Type | Method and Description |
|---|---|
ByteBuf |
encode(ChannelHandlerContext ctx,
ByteBuf msg) |
boolean |
isEncodable(Object msg)
Returns
true if and only if the specified message can be encoded by this encoder. |
flushnewOutboundBufferafterAdd, afterRemove, beforeAdd, beforeRemove, bind, close, connect, deregister, disconnect, exceptionCaught, userEventTriggeredclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitbind, close, connect, deregister, disconnectafterAdd, afterRemove, beforeAdd, beforeRemove, exceptionCaught, userEventTriggeredpublic Base64Encoder()
public Base64Encoder(boolean breakLines)
public Base64Encoder(boolean breakLines,
Base64Dialect dialect)
public boolean isEncodable(Object msg) throws Exception
MessageToMessageEncodertrue if and only if the specified message can be encoded by this encoder.isEncodable in class MessageToMessageEncoder<ByteBuf,ByteBuf>msg - the messageExceptionpublic ByteBuf encode(ChannelHandlerContext ctx, ByteBuf msg) throws Exception
encode in class MessageToMessageEncoder<ByteBuf,ByteBuf>ExceptionCopyright © 2008-2012 The Netty Project. All Rights Reserved.