digitalmars.D.learn - Files as buffered InputRange
- berni (3/3) Jul 05 2019 I'd like to process a (binary) file as a buffered InputRange but
- Les De Ridder (3/6) Jul 05 2019 File.byChunk[1] should do the trick.
- berni (5/8) Jul 05 2019 Not sure, if this is, what I'm looking for. I'd like to do
- Les De Ridder (3/12) Jul 05 2019 You could use `joiner` from std.algorithm, e.g.
- berni (2/17) Jul 05 2019 That's it. Thanks!
I'd like to process a (binary) file as a buffered InputRange but I havn't found anything yet. Is there anything or do I have to write it on my own?
Jul 05 2019
On Friday, 5 July 2019 at 17:29:26 UTC, berni wrote:I'd like to process a (binary) file as a buffered InputRange but I havn't found anything yet. Is there anything or do I have to write it on my own?File.byChunk[1] should do the trick. [1] https://dlang.org/library/std/stdio/file.by_chunk.html
Jul 05 2019
On Friday, 5 July 2019 at 17:57:39 UTC, Les De Ridder wrote:File.byChunk[1] should do the trick. [1] https://dlang.org/library/std/stdio/file.by_chunk.htmlNot sure, if this is, what I'm looking for. I'd like to do something likebuffered_file.map!(a=>2*a).writeln();When I understand it right, with byChunk I'll have to take care about the end of the buffer, myself...
Jul 05 2019
On Friday, 5 July 2019 at 18:29:36 UTC, berni wrote:On Friday, 5 July 2019 at 17:57:39 UTC, Les De Ridder wrote:You could use `joiner` from std.algorithm, e.g. buffered_file.byChunk(4096).joiner.map!(a => 2 * a).writeln;File.byChunk[1] should do the trick. [1] https://dlang.org/library/std/stdio/file.by_chunk.htmlNot sure, if this is, what I'm looking for. I'd like to do something likebuffered_file.map!(a=>2*a).writeln();When I understand it right, with byChunk I'll have to take care about the end of the buffer, myself...
Jul 05 2019
On Friday, 5 July 2019 at 18:45:01 UTC, Les De Ridder wrote:On Friday, 5 July 2019 at 18:29:36 UTC, berni wrote:That's it. Thanks!On Friday, 5 July 2019 at 17:57:39 UTC, Les De Ridder wrote:You could use `joiner` from std.algorithm, e.g. buffered_file.byChunk(4096).joiner.map!(a => 2 * a).writeln;File.byChunk[1] should do the trick. [1] https://dlang.org/library/std/stdio/file.by_chunk.htmlNot sure, if this is, what I'm looking for. I'd like to do something likebuffered_file.map!(a=>2*a).writeln();When I understand it right, with byChunk I'll have to take care about the end of the buffer, myself...
Jul 05 2019