org.jboss.netty.handler.codec.oneone

## Class OneToOneEncoder

- java.lang.Object
- - org.jboss.netty.handler.codec.oneone.OneToOneEncoder

All Implemented Interfaces:
  ChannelDownstreamHandler, ChannelHandler

Direct Known Subclasses:
  Base64Encoder, CompatibleMarshallingEncoder, CompatibleObjectEncoder, HttpMessageEncoder, JdkZlibEncoder, LengthFieldPrepender, MarshallingEncoder, ObjectEncoder, ProtobufEncoder, ProtobufVarint32LengthFieldPrepender, StringEncoder, WebSocket00FrameEncoder, WebSocket08FrameEncoder, WebSocketFrameEncoder, ZlibEncoder

    public abstract class OneToOneEncoder
    extends 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", new DelimiterBasedFrameDecoder(80, Delimiters.nulDelimiter()));
     pipeline.addLast("customDecoder", new OneToOneDecoder() { ... });

     // Encoder
     pipeline.addLast("customEncoder", new OneToOneEncoder() { ... });

### Nested Class Summary

### Nested classes/interfaces inherited from interface org.jboss.netty.channel.ChannelHandler

`ChannelHandler.Sharable`

### Constructor Summary

Constructors
`protected` `OneToOneEncoder()`

### Method Summary

Methods
`protected abstract Object` `encode(ChannelHandlerContext ctx, Channel channel, 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.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### OneToOneEncoder

    protected OneToOneEncoder()

### Method Detail

#### handleDownstream

    public void handleDownstream(ChannelHandlerContext ctx,
                        ChannelEvent evt)
                          throws Exception

Description copied from interface: `ChannelDownstreamHandler`
Handles the specified downstream event.

Specified by:
  `handleDownstream` in interface `ChannelDownstreamHandler`
Parameters:
  `ctx` - the context object for this handler
  `evt` - the downstream event to process or intercept
Throws:
  `Exception`

#### encode

    protected abstract Object encode(ChannelHandlerContext ctx,
                Channel channel,
                Object msg)
                              throws Exception

Transforms the specified message into another message and return the transformed message. Note that you can not return `null`, unlike you can in `OneToOneDecoder.decode(ChannelHandlerContext, Channel, Object)`; you must return something, at least `ChannelBuffers.EMPTY_BUFFER`.

Throws:
  `Exception`