deprecating std.stream, std.cstream, std.socketstream

Robert Clipsham robert at octarineparrot.com
Wed May 16 08:19:46 PDT 2012


On 16/05/2012 15:38, Steven Schveighoffer wrote:
> On Wed, 16 May 2012 09:50:12 -0400, Walter Bright
> <newshound2 at digitalmars.com> wrote:
>
>> On 5/15/2012 3:34 PM, Nathan M. Swan wrote:
>>> I do agree for e.g. with binary data some data can't be read with
>>> ranges (when
>>> you need to read small chunks of varying size),
>>
>> I don't see why that should be true.
>
> How do you tell front and popFront how many bytes to read?
>
> -Steve

A bit ugly but:
----
// Default to 4 byte chunks
auto range = myStream.byChunks(4);
foreach (chunk; range) {
    // Set the next chunk is 3 bytes
    // Chunk after is 4 bytes
    range.nextChunkSize = 3;

    // Next chunk is always 5 bytes
    range.chunkSize = 5;
}
----

-- 
Robert
http://octarineparrot.com/


More information about the Digitalmars-d mailing list