All the above mentioned procedures expect the data to be in the format of your machine's own idea of how the data has to be stored. However, there are situations where you have to read and even write binary data for some other, incompatible architecture.
All architectures that are incompatible with the architecture, libbinio is currently running on, are called alien architectures.
libbinio makes the process of converting between your architecture's and the alien architecture's idea of binary storage completely transparent to you. All you have to do is to specify some characteristics about the stream's binary format, after you have opened it. All newly created streams are initialized with the current system's binary characteristics, so you don't have to do anything if you just want to access data of your own architecture.
You use the setFlag(
flag, [
set])
and
getFlag(
flag)
methods to set and read a stream's
characteristics. flag specifies the flag to be set or read
(refer to Reference for information on what flags are available
and their meaning). The optional argument set specifies whether
the flag should be set (the default) or erased.
After you have set up all flags to sufficiently specify the alien architecture, you can proceed to do binary I/O, just as described in the previous chapters and libbinio will do all the necessary conversion between your own and the alien architecture for you.
If you ever happen to have binary data of multiple, incompatbile, alien architectures in a single stream (very unlikely), you can re-set any of the flags to any other value, in between any of the other stream access method calls. The stream will adhere to the new flag values instantly with the next data access.