License:
BSD style: see license.txtVersion:
Initial release: Oct 2007Author:
Kris These classes represent a simple means of reading and writing discrete data types as binary values, with an option to invert the endian order of numeric values. Arrays are treated as untyped byte streams, with an optional length-prefix, and should otherwise be explicitly managed at the application level. We'll add additional support for arrays and aggregates in future.
1 2 3 4 5 6 | auto input = new DataInput (new File ("path")); auto x = input.int32; auto y = input.float64; auto l = input.read (buffer); // read raw data directly auto s = cast(char[]) input.array; // read length, allocate space input.close; |
required:
1 | auto text = cast(char[]) input.get; |
1 2 3 4 5 6 | auto output = new DataOutput (new File ("path", File.WriteCreate)); output.int32 (1024); output.float64 (3.14159); output.array ("string with length prefix"); output.write ("raw array, no prefix"); output.close; |