[JBoss JIRA] Closed: (NETTY-87) Provide an easy way to reuse existing encoders and decoders
Trustin Lee (JIRA)
jira-events at lists.jboss.org
Wed Dec 3 03:05:36 EST 2008
[ https://jira.jboss.org/jira/browse/NETTY-87?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Trustin Lee closed NETTY-87.
----------------------------
Resolution: Done
org.jboss.netty.handler.codec.embedder package has been added. Here's the simple usage:
DecoderEmbedder<String> e = new DecoderEmbedder<String>(new StringDecoder(...));
if (e.offer(buffer)) {
String decoded = e.poll();
}
e.finish(); // optional - fires a fake channelClosed event
For encoders:
EncoderEmbedder<ChannelBuffer> e = new EncoderEmbedder<ChannelBuffer>(new StringEncoder(...));
if (e.offer("Hello, world!")) {
ChannelBuffer encoded = e.poll();
}
e.finish(); // optional - fires channelClosed event
> Provide an easy way to reuse existing encoders and decoders
> -----------------------------------------------------------
>
> Key: NETTY-87
> URL: https://jira.jboss.org/jira/browse/NETTY-87
> Project: Netty
> Issue Type: Feature Request
> Components: Handler
> Affects Versions: 3.1.0.ALPHA1
> Reporter: Trustin Lee
> Assignee: Trustin Lee
> Fix For: 3.1.0.ALPHA2
>
>
> Codec is merely a simple handler, which means it's designed to be used only in a ChannelPipeline. However, codec should be allowed to be called from outside the pipeline for many reasons. One use case is where a user wants to reuse an existing codec as a part of a higher-level codec (i.e. envelope protocol.) Also, a user might want to reuse the codec to read and write a message from and to a disk.
> There's nothing that prevents a user from doing those things in the Netty core API, but it is true that it's very inconvenient. We could provide a utility class that hides all required steps for calling a codec from anywhere. The required steps will include:
> * Setting up mock objects if necessary
> * Mapping a user request (decode / finishDecode / encode / finishEncode ..) into Netty events (MessageEvent, ChannelStateEvent, and ExceptionEvent) and vice versa.
--
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