Class OneToOneEncoder
- java.lang.Object
-
- org.jboss.netty.handler.codec.oneone.OneToOneEncoder
-
- All Implemented Interfaces:
ChannelDownstreamHandler
,ChannelHandler
- Direct Known Subclasses:
Base64Encoder
,CompatibleMarshallingEncoder
,CompatibleObjectEncoder
,HttpMessageEncoder
,LengthFieldPrepender
,MarshallingEncoder
,NumberEncoder
,ObjectEncoder
,OneToOneStrictEncoder
,ProtobufEncoder
,ProtobufVarint32LengthFieldPrepender
,SocksMessageEncoder
,StringEncoder
,WebSocket00FrameEncoder
,WebSocket08FrameEncoder
public abstract class OneToOneEncoder extends java.lang.Object implements ChannelDownstreamHandler
Transforms a write request into another write request. A typical setup for TCP/IP would be:ChannelPipeline
pipeline = ...; // Decoders pipeline.addLast("frameDecoder", newDelimiterBasedFrameDecoder
(80,Delimiters.nulDelimiter()
)); pipeline.addLast("customDecoder", newOneToOneDecoder
() { ... }); // Encoder pipeline.addLast("customEncoder", newOneToOneEncoder
() { ... });
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.jboss.netty.channel.ChannelHandler
ChannelHandler.Sharable
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
OneToOneEncoder()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected boolean
doEncode(ChannelHandlerContext ctx, MessageEvent e)
protected abstract java.lang.Object
encode(ChannelHandlerContext ctx, Channel channel, java.lang.Object msg)
Transforms the specified message into another message and return the transformed message.void
handleDownstream(ChannelHandlerContext ctx, ChannelEvent evt)
Handles the specified downstream event.
-
-
-
Method Detail
-
handleDownstream
public void handleDownstream(ChannelHandlerContext ctx, ChannelEvent evt) throws java.lang.Exception
Description copied from interface:ChannelDownstreamHandler
Handles the specified downstream event.- Specified by:
handleDownstream
in interfaceChannelDownstreamHandler
- Parameters:
ctx
- the context object for this handlerevt
- the downstream event to process or intercept- Throws:
java.lang.Exception
-
doEncode
protected boolean doEncode(ChannelHandlerContext ctx, MessageEvent e) throws java.lang.Exception
- Throws:
java.lang.Exception
-
encode
protected abstract java.lang.Object encode(ChannelHandlerContext ctx, Channel channel, java.lang.Object msg) throws java.lang.Exception
Transforms the specified message into another message and return the transformed message. Note that you can not returnnull
, unlike you can inOneToOneDecoder.decode(ChannelHandlerContext, Channel, Object)
; you must return something, at leastChannelBuffers.EMPTY_BUFFER
.- Throws:
java.lang.Exception
-
-