inputSourceByChunk

inputSourceByChunk returns a range that reads either a file handle (File) or a ubyte[] array a chunk at a time.

This is a cover for File.byChunk that allows passing an in-memory array as well. At present the motivation is primarily to enable unit testing of chunk-based algorithms using in-memory strings. At present the in-memory input types are limited. In the future this may be changed to accept any type of character or ubyte array.

inputSourceByChunk takes either a File open for reading or a ubyte[] array containing input data. Data is read a buffer at a time. The buffer can be user provided, or allocated by inputSourceByChunk based on a caller provided buffer size.

A ubyte[] input source must satisfy isBufferableInputSource, which at present means that it is a dynamic, mutable ubyte[].

The chunks are returned as an input range.

  1. auto inputSourceByChunk(InputSource source, size_t size)
    inputSourceByChunk
    (
    InputSource
    )
    (
    InputSource source
    ,
    size_t size
    )
  2. auto inputSourceByChunk(InputSource source, ubyte[] buffer)

Meta