OSType
Encyclopedia
OSType is the name of a four-byte sequence
FourCC
A FourCC is a sequence of four bytes used to uniquely identify data formats.The concept originated in the OSType scheme used in the Macintosh system software and was adopted for the Amiga/Electronic Arts Interchange File Format and derivatives...

 commonly used as an identifier in Mac OS
Mac OS
Mac OS is a series of graphical user interface-based operating systems developed by Apple Inc. for their Macintosh line of computer systems. The Macintosh user experience is credited with popularizing the graphical user interface...

. While the bytes can have any value, they usually display figures characterized in software programs such as those utilized in ASCII
ASCII
The American Standard Code for Information Interchange is a character-encoding scheme based on the ordering of the English alphabet. ASCII codes represent text in computers, communications equipment, and other devices that use text...

 or Mac OS Roman
Mac OS Roman
Mac OS Roman is a character encoding primarily used by Mac OS to represent text. It encodes 256 characters, the first 128 of which are identical to ASCII, with the remaining characters including mathematical symbols, diacritics, and additional punctuation marks. It is suitable for use to represent...

 character sets.

OSType values are used to identify file data format types and the applications that created them. The separation of file types
Type code
A type code is the only mechanism used in pre-Mac OS X versions of the Macintosh operating system to denote a file's format, in a manner similar to file extensions in other operating systems. Codes are four-byte OSTypes...

 and creators
Creator code
A creator code is a mechanism introduced in pre-Mac OS X versions of the Macintosh operating system to link a data file to the application program which created it, in a manner similar to file extensions in other operating systems. Codes are four-byte OSTypes. For example, the creator code of the...

 allowed the coexistence of documents of the same format belonging to different applications; it is easy 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
Type code
A type code is the only mechanism used in pre-Mac OS X versions of the Macintosh operating system to denote a file's format, in a manner similar to file extensions in other operating systems. Codes are four-byte OSTypes...

 (one OSType) and creator code
Creator code
A creator code is a mechanism introduced in pre-Mac OS X versions of the Macintosh operating system to link a data file to the application program which created it, in a manner similar to file extensions in other operating systems. Codes are four-byte OSTypes. For example, the creator code of the...

 (another OSType), fork length, and the file name.

The resource fork
Resource fork
The resource fork is a construct of the Mac OS operating system used to store structured data in a file, alongside unstructured data stored within the data fork. A resource fork stores information in a specific form, such as icons, the shapes of windows, definitions of menus and their contents, and...

 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
Clipboard (software)
The clipboard is a software facility that can be used for short-term data storage and/or data transfer between documents or applications, via copy and paste operations...

, 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
QuickDraw
QuickDraw is the 2D graphics library and associated Application Programming Interface which is a core part of the classic Apple Macintosh operating system. It was initially written by Bill Atkinson and Andy Hertzfeld. QuickDraw still exists as part of the libraries of Mac OS X, but has been...

 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
Endianness
In computing, the term endian or endianness refers to the ordering of individually addressable sub-components within the representation of a larger data item as stored in external memory . Each sub-component in the representation has a unique degree of significance, like the place value of digits...

 is clearly defined. In programming, an OSType made of human-readable characters can be conveniently specified as a C
C (programming language)
C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system....

 multi-character literal, which allows you to specify an integer literal, whose bytes are made up of human-readable characters.

Since Mac OS X
Mac OS X
Mac OS X is a series of Unix-based operating systems and graphical user interfaces developed, marketed, and sold by Apple Inc. Since 2002, has been included with all new Macintosh computer systems...

 10.3
Mac OS X v10.3
Mac OS X Panther is the fourth major release of Mac OS X, Apple’s desktop and server operating system. It followed Mac OS X v10.2 "Jaguar" and preceded Mac OS X Tiger...

, OSType signatures are one of several sources that may be examined to determine a Uniform Type Identifier
Uniform Type Identifier
A Uniform Type Identifier is a text string used on software provided by Apple Inc. to uniquely identify a given class or type of item...

 and are no longer used as the primary data type signature.

Other uses for OSTypes include:
  • as Gestalt
    Gestalt (Mac OS)
    Gestalt was the name of a system call introduced into the Apple Macintosh operating system System Software 6.0.4 in 1989 to allow applications to dynamically query what capabilities were present in the running system configuration....

     selector codes
  • as record field IDs and event type and class IDs in AppleEvents
  • for identifying components in the Component Manager
    Component Manager
    In Apple Macintosh computer programming, Component Manager was one of many approaches to sharing code that originated on the pre-PowerPC Macintosh. It was originally introduced as part of QuickTime, which remained the part of Mac OS that used it most heavily....

  • as "atom" IDs in the QuickTime
    QuickTime
    QuickTime is an extensible proprietary multimedia framework developed by Apple Inc., capable of handling various formats of digital video, picture, sound, panoramic images, and interactivity. The classic version of QuickTime is available for Windows XP and later, as well as Mac OS X Leopard and...

     movie and image file formats
  • as a localization-independent way of identifying standard folders in the Folder Manager
  • in QuickDraw GX
    QuickDraw GX
    QuickDraw GX was a replacement for the QuickDraw 2D graphics engine and Printing Manager inside the "classic" Mac OS. Its underlying drawing platform was a resolution-independent object oriented retained mode system, making it much easier for programmers to perform common tasks...

    , they were used as gxTag types and also as types of collection items in the Collection Manager.
  • as error code
    Error code
    In computer programming, error codes are enumerated messages that correspond to faults in a specific software application. They are typically used to identify faulty hardware, software, or incorrect user input in programming languages that lack exception handling, although they are sometimes also...

    s in certain libraries, such as QuickTime


FourCC
FourCC
A FourCC is a sequence of four bytes used to uniquely identify data formats.The concept originated in the OSType scheme used in the Macintosh system software and was adopted for the Amiga/Electronic Arts Interchange File Format and derivatives...

 is a system of data format
File format
A file format is a particular way that information is encoded for storage in a computer file.Since a disk drive, or indeed any computer storage, can store only bits, the computer must have some way of converting information to 0s and 1s and vice-versa. There are different kinds of formats for...

 identification used in some platform-independent multimedia containers, such as AIFF
AIFF
Audio Interchange File Format is an audio file format standard used for storing sound data for personal computers and other electronic audio devices...

 and RIFF. It inherits may codes from the OSType. Similar system is also used in TrueType
TrueType
TrueType is an outline font standard originally developed by Apple Computer in the late 1980s as a competitor to Adobe's Type 1 fonts used in PostScript...

 font format.

See also

  • Magic number
  • Interchange File Format
    Interchange File Format
    Interchange File Format , is a generic container file format originally introduced by the Electronic Arts company in 1985 in order to ease transfer of data between software produced by different companies....

  • Uniform Type Identifier
    Uniform Type Identifier
    A Uniform Type Identifier is a text string used on software provided by Apple Inc. to uniquely identify a given class or type of item...

    Mac OS X's replacement for OSType based identifiers.
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK