users@websocket-spec.java.net

[jsr356-users] [jsr356-experts] Re: Updated Spec: v005: Close to EDR

From: Danny Coward <danny.coward_at_oracle.com>
Date: Fri, 21 Sep 2012 17:25:52 -0700

>>> There needs to be a Encoder.BinaryStream and Encoder.CharacterStream
>>> and corresponding Decoders (names can be different of course.)
>>
>> Thanks Scott.
>>
>> I guess that would allow the encoders and decoders to be
>> stream-based. Something like:
>>
>> public interface Encoder.CharacterStream<T> extends Encoder {
>> public Reader encode(T object) throws EncodeException;
>> }
>>
>> (and analagous for binary encoder & the Decoders) ?
>
> Yes, but different signature:
>
> public void encode(Writer writer, T object);
> public T decode(Reader reader);
>
> public void encode(OutputStream os, T object);
> public T decode(InputStream is);
>
> where the streams come from the websocket implementation (not the
> encoder/decoder).
>
> That will match up nicely with existing remoting systems, making them
> easy to implement. Efficient too, because they can be implemented
> without any extra buffering needed for either direction.

Ok now I get it. Yes. I have added this into the new draft. Thanks for
the suggestion.

- Danny