Storages & Files SysByteOrder
SysByteOrder read only property (with parameter)

Returns the system byte order flags.

Syntax:

flags = object.SysByteOrder([which])

Parameters:

which - numeric constant. Specifies what information to be extracted. Default is 0. Currently supported constants:
0 - Numeric byte order
1 - UNICODE byte order

Return result:  flags for the systems - see the remarks section below.

Remarks:

In general a Boolean indicator for the byte order conversions is enough. However this may need a bit more code in the application. To make this more convenient we use flag set that describes the source and the destination. Depending on their values the objects that support byte order dependent functions decide if a conversion is needed. This allows the developer just combine the system and the source byte order flags in order to compose the correct flags.

Flags:
bit 0: System. 0 - little endian, 1 - big endian
bit 1: Media: 0 - little endian, 1 - big endian
bit 2: Explicit conversion. 0 - off, 1 - force reorder no matter what are the other flags. 

The routines where byte order must be considered usually work with data from external media (file, buffer read from stream/file) and the system memory. So the bit 0 describes the native byte order for the OS/machine in its memory. Changing the bit 1 you can specify what is the byte order in the external media.

All the Windows OS versions currently in use are little endian (this includes Windows CE). Therefore this property will return on all the platforms 0. When you work with data obtained from big endian system (for example Mac or some Unix OS-es) or using big endian byte order because of some standard requirements (for example IP or port numbers in network byte order) you can set the bit 1 to 1 in order to cause conversion when the data is read or written from to the external media or the buffer.

Information: Most machines today use little endian byte order (less significant byte first) and these features are mostly useful when working with standards that require the numeric data to be stored in big endian byte order (most significant byte first). So, except in administrative, format conversion or utility scripts these features rarely need your attention. However the developers of business applications that may use some external data sources (import/export files for example) are advised to check if these files/data are supposed to be read/written by other applications working on big endian systems such as Macintosh and see if a conversion (or option for it) would be needed to support them.

Objects that use byte order flags: SFFilter, SFBinaryData.

Applies to: SFMain object

Supported on:

Windows 95/NT and later
Windows CE 3.0 and later
Pocket PC/Windows Mobile 2003 and later
Windows CE.NET 4 and later

 

newObjects Copyright 2001-2006 newObjects [ ]