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, CompatibleObjectEncoder, HttpMessageEncoder, LengthFieldPrepender, ObjectEncoder, ProtobufEncoder, ProtobufVarint32LengthFieldPrepender, StringEncoder, 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
() { ... });
- Version:
- $Rev:231 $, $Date:2008-06-12 16:44:50 +0900 (목, 12 6월 2008) $
- Author:
- The Netty Project, Trustin Lee
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
OneToOneEncoder
protected OneToOneEncoder()
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 handlerevt
- 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
Copyright © 2008-2011 JBoss, a division of Red Hat, Inc.. All Rights Reserved.