*** Welcome to piglix ***

OSType


OSType (also known as ResType) is the name of a four-byte sequence commonly used as an identifier in the classic Mac OS. While the bytes can have any value, they usually display figures characterized in software programs such as those used in ASCII or Mac OS Roman character sets.

OSType values are used to identify file data format types and the applications that created them. The separation of file types and creators allowed the coexistence of documents of the same format belonging to different applications; it is possible to reassign the ownership of any of these documents to any supporting application without changing its name or otherwise affecting its contents.

Macintosh file systems have a separate area for metadata distinct from either the data or resource fork. The catalogue entry for each file stores just the creation and modification timestamp, the file type code (one OSType) and creator code (another OSType), fork length, and the file name.

The resource fork of a file in a Macintosh file system stores an OSType identifier with each resource.

OSTypes are also used to identify the type of data in places other than files: for instance, on the Clipboard, or in AppleEvents. They tend to have common meanings across these uses: for instance, 'TEXT' identifies a block of text (encoding unspecified, but usually ASCII or Mac Roman), while 'PICT' indicates a QuickDraw picture.

Four byte identifiers are useful because they can be made up of four human-readable characters with mnemonic qualities, while still fitting in the four byte memory space typically allocated for integers in 32-bit systems. From a memory management standpoint, they're easier to handle than, for example, character strings of variable length. Compared to arbitrary 32-bit integer values, they are unambiguous since the byte-order is clearly defined. In programming, an OSType made of human-readable characters can be conveniently specified as a C multi-character literal, which allows you to specify an integer literal, whose bytes are made up of human-readable characters.


...
Wikipedia

...