Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jboss.netty.handler.codec.oneone
Class OneToOneDecoder

    java.lang.Object
      org.jboss.netty.handler.codec.oneone.OneToOneDecoder

All Implemented Interfaces:
  ChannelHandler, ChannelUpstreamHandler

Direct Known Subclasses:
  Base64Decoder, ProtobufDecoder, StringDecoder, ZlibDecoder

    public abstract class OneToOneDecoder

extends Object
implements ChannelUpstreamHandler

Transforms a received message into another message. Please note that this decoder must be used with a proper `FrameDecoder` such as `DelimiterBasedFrameDecoder` or you must implement proper framing mechanism by yourself if you are using a stream-based transport such as TCP/IP. 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() { ... });

Version:
  $Rev:231 $, $Date:2008-06-12 16:44:50 +0900 (목, 12 6월 2008) $
Author:
  The Netty Project, Trustin Lee

Nested Class Summary

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

Constructor Summary
`protected` | `OneToOneDecoder()` Creates a new instance with the current system character set.

Method Summary
`protected abstract Object` | `decode(ChannelHandlerContext ctx, Channel channel, Object msg)` Transforms the specified received message into another message and return the transformed message.
`void` | `handleUpstream(ChannelHandlerContext ctx, ChannelEvent evt)` Handles the specified upstream event.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### OneToOneDecoder

    protected OneToOneDecoder()

  Creates a new instance with the current system character set.

Method Detail

### handleUpstream

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

  Description copied from interface: `ChannelUpstreamHandler`
  Handles the specified upstream event.

  Specified by:
    `handleUpstream` in interface `ChannelUpstreamHandler`
  Parameters:
    `ctx` - the context object for this handler
    `evt` - the upstream event to process or intercept
  Throws:
    `Exception`

### decode

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

  Transforms the specified received message into another message and return the transformed message. Return `null` if the received message is supposed to be discarded.

  Throws:
    `Exception`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2008-2010 JBoss, a division of Red Hat, Inc.. All Rights Reserved.