readFileData

Read data from one or more files. This routine is used by algorithms needing to read all data into memory.

readFileData reads in all data from a set of files. Data is returned as an array of InputBlock structs. Normally one InputBlock per file, sized to match the size of the file. Standard input is read in one or more blocks, as are files whose size cannot be determined. Multiple blocks are used in these last two cases to avoid expensive memory reallocations. This is not necessary when file size is known as the necessary memory can be preallocated.

Individual lines never span multiple blocks, and newlines are preserved. This means that each block starts at the beginning of a line and ends with a newline unless the end of a file has been reached.

Each file gets its own block. Prior to using InputSourceRange this was so header processing can be done. With InputSourceRange the header is read separately, so this could be changed.

readFileData
(
HasRandomValue hasRandomValue
OutputRange
)
(,
auto ref OutputRange outputStream
)
if (
isOutputRange!(OutputRange, char)
)

Meta