public class ChannelBufferProtocol extends AbstractNettyProtocol
ChannelPipeline
. For out
going messages it will set the length using the LengthFieldPrepender
encoder. The binary packets it receives will be of the format
[OPCODE][LENGTH][PAYLOAD] will find this protocol the most useful.Modifier and Type | Field and Description |
---|---|
private EventDecoder |
eventDecoder |
private EventEncoder |
eventEncoder |
private org.jboss.netty.handler.codec.frame.LengthFieldPrepender |
lengthFieldPrepender
Utility handler provided by netty to add the length of the outgoing
message to the message as a header.
|
private static org.slf4j.Logger |
LOG |
IDLE_CHECK_HANDLER, IDLE_STATE_CHECK_HANDLER
Constructor and Description |
---|
ChannelBufferProtocol() |
Modifier and Type | Method and Description |
---|---|
void |
applyProtocol(PlayerSession playerSession)
The main method of this interface.
|
EventDecoder |
getEventDecoder() |
EventEncoder |
getEventEncoder() |
org.jboss.netty.handler.codec.frame.LengthFieldPrepender |
getLengthFieldPrepender() |
void |
setEventDecoder(EventDecoder eventDecoder) |
void |
setEventEncoder(EventEncoder eventEncoder) |
void |
setLengthFieldPrepender(org.jboss.netty.handler.codec.frame.LengthFieldPrepender lengthFieldPrepender) |
applyProtocol, createLengthBasedFrameDecoder, getProtocolName
private static final org.slf4j.Logger LOG
private org.jboss.netty.handler.codec.frame.LengthFieldPrepender lengthFieldPrepender
private EventDecoder eventDecoder
private EventEncoder eventEncoder
public void applyProtocol(PlayerSession playerSession)
Protocol
LoginHandler
or whichever previous
handler was handling the message has cleared up the
ChannelPipeline
object.playerSession
- The user session for which the protocol handlers need to be
set.public org.jboss.netty.handler.codec.frame.LengthFieldPrepender getLengthFieldPrepender()
public void setLengthFieldPrepender(org.jboss.netty.handler.codec.frame.LengthFieldPrepender lengthFieldPrepender)
public EventDecoder getEventDecoder()
public void setEventDecoder(EventDecoder eventDecoder)
public EventEncoder getEventEncoder()
public void setEventEncoder(EventEncoder eventEncoder)
Copyright © 2013. All Rights Reserved.