You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by daniel vettori <da...@gmail.com> on 2012/09/03 15:36:21 UTC

multiple delimiters support with apache mina

Hi,

I m using Apache mina in my socket component. I used TextLineDecoder as my
sample for my Socket component. In my component i m using single delimiter
as end of message to/from socket. Now, i want to implement same thing with
multiple delimiters support.
Supposee i have message as (with delimiters ; :  ,)
this;is:sample,

and output as
this
is
sample

So,how should i approach for this problem...


Thanks

Daniel

Re: multiple delimiters support with apache mina

Posted by daniel vettori <da...@gmail.com>.
On Tue, Sep 4, 2012 at 8:44 AM, Emmanuel Lécharny <el...@gmail.com>wrote:

> Le 9/3/12 3:36 PM, daniel vettori a écrit :
>
>  Hi,
>>
>> I m using Apache mina in my socket component. I used TextLineDecoder as my
>> sample for my Socket component. In my component i m using single delimiter
>> as end of message to/from socket. Now, i want to implement same thing with
>> multiple delimiters support.
>> Supposee i have message as (with delimiters ; :  ,)
>> this;is:sample,
>>
>> and output as
>> this
>> is
>> sample
>>
>> So,how should i approach for this problem...
>>
>
> The best solution would be to write your own version of the
> TextLinedecoer, a version accepting more than one delimiter.
>
> Just have a look at the TexlineDecoder code, you should be able to extend
> it to get what you need.
> http://mina.apache.org/report/**trunk/xref/org/apache/mina/**
> filter/codec/textline/**TextLineDecoder.html<http://mina.apache.org/report/trunk/xref/org/apache/mina/filter/codec/textline/TextLineDecoder.html>
>
> --
> Regards,
> Cordialement,
> Emmanuel Lécharny
> www.iktek.com
>
>

Hi,
I agree with you. For time being what i m doing is for the delimiter string
, i take multiple delimters separated by space and then have the delimiters
in the Stringbuffer and  convert them to byte buffer.Comparing the
delimiters bytebuffer with the input bytebuffer.what i m facing problem is
,then i have to compare the result and keep it in separate decoded buffer
......

Thanks
Daniel

Re: multiple delimiters support with apache mina

Posted by Emmanuel Lécharny <el...@gmail.com>.
Le 9/3/12 3:36 PM, daniel vettori a écrit :
> Hi,
>
> I m using Apache mina in my socket component. I used TextLineDecoder as my
> sample for my Socket component. In my component i m using single delimiter
> as end of message to/from socket. Now, i want to implement same thing with
> multiple delimiters support.
> Supposee i have message as (with delimiters ; :  ,)
> this;is:sample,
>
> and output as
> this
> is
> sample
>
> So,how should i approach for this problem...

The best solution would be to write your own version of the 
TextLinedecoer, a version accepting more than one delimiter.

Just have a look at the TexlineDecoder code, you should be able to 
extend it to get what you need.
http://mina.apache.org/report/trunk/xref/org/apache/mina/filter/codec/textline/TextLineDecoder.html

-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com