From: Jean Privat Date: Wed, 20 May 2015 00:30:25 +0000 (-0400) Subject: Merge: Read/Write binary data X-Git-Tag: v0.7.5~43 X-Git-Url: http://nitlanguage.org Merge: Read/Write binary data The module `binary` adds services to `Writer` and `Reader` to read/write binary data. The services offer different size for each kind of data. They can be used to save space on a stream or for compatibility with external programs. They use type names from C: * `write_float` write a Nit `Float` on 32 bits, with loss of precision. * `write_double` write a Nit `Float` on 64 bits. * `write_int64` write a Nit `Int` on 64 bits, with usually no loss of data, but it may still happen per platform. * `write_bool` and `write_bits` to write booleans as a byte. * There's a TODO for other suggested methods. The endianess of each stream is configurable. I tried to avoid touching too much to the main stream code knowing that @R4PaSs is working on reading/writing bytes. The binary module will have to be updated when we have a `Byte` type. Also, all the others types of `Writer` must be modified to implement `write_byte`. I'll use this to write a binary alternative to json_serialization. Pull-Request: #1354 Reviewed-by: Lucas Bajolet Reviewed-by: Alexandre Terrasa --- ecc38fae3f0095a8f054289750c96bc900005e33