[JBoss JIRA] Resolved: (NETTY-187) Subsitute ReplayingDecoder with FrameDecoder without losing stored buffer
Trustin Lee (JIRA)
jira-events at lists.jboss.org
Mon Jul 6 07:35:51 EDT 2009
[ https://jira.jboss.org/jira/browse/NETTY-187?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Trustin Lee resolved NETTY-187.
-------------------------------
Resolution: Done
ReplayingDecoder.actualReadableBytes() has been added to the trunk. Therefore, you can apply the same technique to the first decoder whose type is ReplayingDecoder:
public class FirstDecoder extends ReplayingDecoder {
public FirstDecoder() {
super(true); // Enable unfold
}
protected Object decode(ctx, buf) {
...
// Decode the first message
Object firstMessage = ...;
// Add the second decoder
ctx.getPipeline().addLast("second", new SecondDecoder());
// Remove the first decoder (me)
ctx.getPipeline().remove(this);
if (buf.readable()) {
// Hand off the remaining data to the second decoder
return new Object[] { firstMessage, buf.readBytes(super.actualReadableBytes()) };
} else {
// Nothing to hand off
return firstMessage;
}
}
}
> Subsitute ReplayingDecoder with FrameDecoder without losing stored buffer
> -------------------------------------------------------------------------
>
> Key: NETTY-187
> URL: https://jira.jboss.org/jira/browse/NETTY-187
> Project: Netty
> Issue Type: Feature Request
> Components: Handler
> Affects Versions: 3.0.2.GA
> Environment: Using ubuntu 9.10, java 6
> Reporter: Miguel Angel Cabrera
> Assignee: Trustin Lee
> Priority: Minor
>
> I try to replace a ReplayingDecoder with a FrameDecoder but the buffered data is lost, i would need a mechanism to hand remaining data in buffer to the next handler.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the netty-dev
mailing list