ReplayDecoder and LITTLE_ENDIANness
UweH
uwe.hehn.external at eads.com
Fri Apr 30 04:52:32 EDT 2010
Trustin Lee wrote:
>
> Hello,
>
> Sorry for a late reply.
>
> Could you post the source code of TracingFrameDecoder? I can find only
> the one derived from Replayingdecoder.
>
> Trustin
>
Sorry, I dont have the exact code at hand anymore, since it didn't work.
(The point is, that the Decoder needs to extend ReplayingDecoder instead of
FrameDecoder to work in my setup).
BUT, it was basically like this:
public class TracingFrameDecoder extends FrameDecoder {
private final List<TracingSignal> tracingSignals = new
LinkedList<TracingSignal>();
@Override
protected Object decode(ChannelHandlerContext ctx, Channel channel,
ChannelBuffer buffer) throws Exception {
System.out.println("converted buffer class: " + buffer.getClass());
System.out.println("converted buffer byte order: " + buffer.order());
if (buffer.readableBytes() < 5) {
return null;
}
buffer.markReaderIndex();
buffer.readByte(); // over-read endianess byte
final long messageSize = buffer.readUnsignedInt();
if (buffer.readableBytes() < messageSize) {
buffer.resetReaderIndex();
return null;
}
tracingSignals.clear();
// read bytes and fill tracingSignals
return Collections.unmodifiableList(tracingSignals);
}
}
--
View this message in context: http://netty-forums-and-mailing-lists.685743.n2.nabble.com/ReplayDecoder-and-LITTLE-ENDIANness-tp4906895p4984566.html
Sent from the Netty User Group mailing list archive at Nabble.com.
More information about the netty-users
mailing list