streaming redux

Dmitry Olshansky dmitry.olsh at gmail.com
Thu Dec 30 13:59:13 PST 2010


On 28.12.2010 16:08, Daniel Gibson wrote:
[snip]
> ## UnbufferedInputTransport:
>
> I'd like "void readFully(ubyte[] buffer)" which reads buffer.length 
> bytes or throws an exception if that is not possible
> This would also fix busy-waiting (it'd block until buffer.length bytes 
> are available).
>
> Also "size_t read(void* buffer, size_t length)" (and the same for 
> readFully()) would be nice, so one can read from the stream to buffers 
> of arbitrary type without too much casting. Is probably especially 
> handy when used with (data from) extern(C) functions and such.
>
> Also, for convenience: "ubyte[] read(size_t length)" (does something 
> like "return read(new ubyte[length]);"
> and "ubyte[] readFully(size_t length)"

This, I guess, would be provided by free functions in the same module, 
there is no point in requiring to implement them inside the stream itself.
>
> ## UnbufferedOutputTransport:
>
> I'd like "void write(void *buffer, size_t length)" - for the same 
> reason as read(void* buffer, size_t length).

Ditto



More information about the Digitalmars-d mailing list