Details
Description
The following methods on the File class would be welcome:
The terms 'short', 'int', and 'long' should be documented to mean 16, 32, and 64 bit integers, respectively. The S and U infixes are signed and unsigned. The BE and LE suffixes are of course, endianness.
If the argument to any of the following functions is out of range, it should wrap. If the argument to any of the following functions is of the incorrect data type or in an invalid format, an exception should be thrown.
- writeSByte
- writeByte
- writeShortBE
- writeShortLE
- writeUShortBE
- writeUShortLE
- writeIntBE
- writeIntLE
- writeUIntBE
- writeUIntLE
- writeLongBE
- writeLongLE
- writeULongBE
- writeULongLE
- writeFloat - write a 32-bit floating point number in IEEE 754 format
- writeDouble - write a 64-bit floating point number in IEEE 754 format
- writeBool - equivalent to writeByte(x ? 1 : 0)
- writeBytes - write an array of unsigned bytes; the argument is a hex string such as "ff34f207"
While we're at it, might as well add read support?
Corresponding read functions which take no arguments are needed for all the numeric/bool write functions. Lastly, readBytes takes a number argument specifying the number of bytes to read, or can be left unspecified to read until EOF is reached. It returns a hex string.
All functions should throw an exception on I/O error, additionally read functions should throw an exception when attempting to read past EOF.
Attachments
Issue Links
- is required for
-
QBS-416 Add support for building macOS disk image installers (drag and drop)
- Closed