On 16.05.2012 19:32, Steven Schveighoffer wrote:
On Wed, 16 May 2012 11:19:46 -0400, Robert Clipsham
<[email protected]> wrote:
On 16/05/2012 15:38, Steven Schveighoffer wrote:
On Wed, 16 May 2012 09:50:12 -0400, Walter Bright
<[email protected]> 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;
}
Yeah, I've seen this before. It's not convincing.
Yes, It's obvious that files do *not* generally follow range of items
semantic. I mean not even range of various items.
In case of binary data it's most of the time header followed by various
data. Or hierarchical structure. Or table of links + raw data.
Or whatever. I've yet to see standard way to deal with binary formats :)
--
Dmitry Olshansky