jsr356-experts@websocket-spec.java.net

[jsr356-experts] Re: Streaming Options

From: Mark Thomas <mark_at_homeinbox.net>
Date: Sun, 05 Aug 2012 10:05:43 +0100

Resending from the right address.

On 13/07/2012 03:26, Greg Wilkins wrote:
> On 13 July 2012 09:25, Danny Coward <danny.coward_at_oracle.com> wrote:
>>
>> Of the choices in mode (3), I'd probably go for option A). However, I do
>> think many developers (me at least, but not Greg!) find the NIO APIs
>> awkward, so can see a benefit in the simplicity of option
>
> Actually I'm not a big fan of the NIO APIs(specially the read side,
> write side is OKish) - I just raise them as something we should
> consider as they are part of the JVM, so developers will be familiar
> with them. If we do something different, that's fine, so long as we
> know the reasons why.
>
> However, I do like ByteBuffer a lot more than byte[] and I think we
> should use the former rather than the later. Arrays can be trivially
> wrapped as ByteBuffers, but it is more expensive to convert a
> ByteBuffer to an array - so it is best to go with ByteBuffers.

+1

It looks to me like 3B as the 'lowest' level with the API providing 1
and 2 on top. The efficiencies this offers makes this worth doing. It
also saves multiple frameworks that will sit on top of the API having to
re-invent the same wheel.

Mark