On 10/16/07, Drac <[EMAIL PROTECTED]> wrote:
>
> You don't need a new protocol class for this, just add a constructor overide
> to the TextLineCodecFactory class (or extend the class) to take custom
> encoder and decoder LineDelmiter strings like so:
>
> public TextLineCodecFactory(Charset charset, String encoderDelimStr, String
> decoderDelimStr) {
>         encoder = new TextLineEncoder(charset, new 
> LineDelimiter(encoderDelimStr));
>         decoder = new TextLineDecoder(charset, new 
> LineDelimiter(decoderDelimStr));
> }
>
> Then just construct your codec like so:
>
> TextLineCodecFactory codec = new TextLineCodecFactory(Charset.forName(
> "UTF-8"), "\0", "\0");
>
> I was a little surprised that the line delimiters were hard coded into the
> constructor to begin with, and that there was no way to access the
> decoder/encoder to change them. Wouldn't this be one of the most varied
> values from application to application? I'm not sure, I don't do much
> networking stuff so maybe the defaults are used by most systems and Flash is
> a bit of an oddball in that respect. I also guess it's easy enough to extend
> the class and work this in, but it had me scratching my head for half a day
> before I dug deep enough to find this.

Your concern already has been addressed in our development branch
(trunk); LineDelimiter.NUL and related constructors have been added.

HTH,
Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6

Reply via email to