Uniform Type Identifier
Encyclopedia
A Uniform Type Identifier (UTI) is a text string used on software provided by Apple Inc. to uniquely identify a given class or type of item. Apple provides built-in UTIs to identify common system objects — document or image file types, folders and application bundles, streaming data, clipping data, movie data — and allows third party developers to easily add their own UTIs for application-specific or proprietary uses. Support for UTIs was added in the 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.4
Mac OS X v10.4
Mac OS X v10.4 Tiger is the fifth major release of Mac OS X, Apple's desktop and server operating system for Macintosh computers. Tiger was released to the public on 29 April 2005 for US$129.95 as the successor to Mac OS X Panther , which had been released 18 months earlier...

 operating system, integrated into the Spotlight
Spotlight (software)
Spotlight is a system-wide desktop search feature of Apple's Mac OS X operating system. Spotlight is a selection-based search system, which creates a virtual index of all items and files on the system. It is designed to allow the user to quickly locate a wide variety of items on the computer,...

 desktop search technology, which uses UTIs to categorize documents. One of the primary design goals of UTIs was to eliminate the ambiguities and problems associated with inferring a file's content from its MIME type, filename extension
Filename extension
A filename extension is a suffix to the name of a computer file applied to indicate the encoding of its contents or usage....

, or type
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...

 or 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...

.

UTIs use a reverse-DNS
Reverse-DNS
The Reverse-DNS is a naming convention for the components, packages, and types used by a programming language, system or framework. A characteristic of reverse-DNS strings is that they are based on registered domain names, and are only reversed for sorting purposes...

 naming structure. Names may include the 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...

 characters A-Z, a-z, 0-9, hyphen ("-"), and period ("."), and all Unicode
Unicode
Unicode is a computing industry standard for the consistent encoding, representation and handling of text expressed in most of the world's writing systems...

 characters above U+007F.. Colons and slashes are prohibited for compatibility with Macintosh and POSIX file path conventions. UTIs support multiple inheritance
Multiple inheritance
Multiple inheritance is a feature of some object-oriented computer programming languages in which a class can inherit behaviors and features from more than one superclass....

, allowing files to be identified with any number of relevant types, as appropriate to the contained data.

Background

One of the difficulties in maintaining a user-accessible operating system is establishing connections between data types and the applications or processes that can effectively use such data. For example, a file that contains picture data in a particular compression format can only be opened and processed in applications that are capable of handling picture data, and those applications must be able to identify which compression type was used in order to extract and work with that data. In early computer systems — particularly DOS
DOS
DOS, short for "Disk Operating System", is an acronym for several closely related operating systems that dominated the IBM PC compatible market between 1981 and 1995, or until about 2000 if one includes the partially DOS-based Microsoft Windows versions 95, 98, and Millennium Edition.Related...

 and its variants, and still currently true on Unix
Unix
Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna...

 and the Windows OS — file associations are maintained by file extensions. The three to four character code following a file name instructs the system to open the file in particular applications. However, file extensions can be forgotten or lost in the process of editing or creating files or transferring files between machines, which in early systems rendered the files unreadable and unusable. Further, file extension names were loosely defined: for instance, a JPEG file might have the extension .jpg, .jpeg, .JPG, or other variants, and text files might use .text or .txt, making determination of file contents more complex.

Beginning with System 1, Macintosh operating systems have attached 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...

s 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...

s as part of the file metadata
Metadata
The term metadata is an ambiguous term which is used for two fundamentally different concepts . Although the expression "data about data" is often used, it does not apply to both in the same way. Structural metadata, the design and specification of data structures, cannot be about data, because at...

. These four character codes were designed to specify both the application that created the file (the creator code) and the specific type of the file (the type code) so that other applications could easily open and process the file data. However, while type and creator codes extended the flexibility of the system — a particular type of file was not restricted to opening in a particular application — they suffered many of the same problems as file extensions. Type and creator codes could be lost when files were transferred across non-Macintosh systems (such as Unix-based servers), and the plethora of type codes made identification problematic.

Other file identification types exist: for example, MIME Types are used for identifying data that is transferred over the web. However, Apple's UTI system was designed to create a flexible file association system that would describe data hierarchically and allow for better categorization and searching, standardize data descriptions across contexts, and provide a uniform method of expanding data types. For instance, the public.jpeg and public.png UTIs inherit from the public.image UTI, allowing users to search narrowly for JPEG images or PNG images or broadly for any kind of image merely by changing the specificity of the UTI used in the search. Further, application developers who design new data types can easily extend the UTIs available. For example, a new image format developed by a company may have a UTI of com.company.proprietary-image and be specified to inherit from the public.image type.

Apple's 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...

 continues to support other forms of file association, and contains utilities for translating between them, but will use UTIs by preference where available.

UTI structure

Apple maintains the public.* domain as a set base data types for all UTIs. Other UTIs are associated with these base UTIs by conformance, a system similar to class inheritance. UTIs that conform to other UTIs share a basic types, and in general any application that works with data of a more general UTI should be able to work with data of any UTI that conforms to that general UTI.

Apple public UTIs

The most basic public UTIs in the Apple hierarchy are as follows:
Identifier Conforms to Comment
public.item base class in the physical hierarchy
public.content base class for all document content
public.data public.item base class for all files, byte streams, pasteboard, etc.
public.image public.data, public.content base class for all images


UTIs are even used to identify other file type identifiers:
Identifier Conforms to Comment
public.filename-extension public.case-insensitive-text Filename extension
Filename extension
A filename extension is a suffix to the name of a computer file applied to indicate the encoding of its contents or usage....

public.mime-type public.case-insensitive-text MIME type
MIME
Multipurpose Internet Mail Extensions is an Internet standard that extends the format of email to support:* Text in character sets other than ASCII* Non-text attachments* Message bodies with multiple parts...

com.apple.ostype public.text Four-character code (type OSType
OSType
OSType is the name of a four-byte sequence commonly used as an identifier in Mac OS. While the bytes can have any value, they usually display figures characterized in software programs such as those utilized in ASCII or Mac OS Roman character sets.OSType values are used to identify file data...

)
com.apple.nspboard-type public.text NSPasteboard type


Dynamic UTIs can be created as needed by applications; these have the prefix dyn. and take the form of "a UTI-compatible wrapper around an otherwise unknown filename extension, MIME type, OSType, and so on."

Third party UTIs

Apple provides a large collection of system-declared Uniform Type Identifiers. Third-party applications can add UTIs to the database maintained by Mac OS X by "exporting" UTIs declared within the application package. Because new UTIs can be declared to "conform to" existing system UTIs, and declarations can associate the new UTIs with file extensions, an exported declaration alone can provide the operating system with enough information to enable new functionality, such as enabling Quick Look
Quick Look
Quick Look is a quick preview feature developed by Apple which was introduced in their operating system, Mac OS X v10.5 "Leopard". It was announced and demonstrated at Apple's Worldwide Developers Conference 2007.-Overview:...

 for new file types.

Looking up a UTI

To get the UTI of a given file, use the mdls (meta data list, part of Spotlight
Spotlight (software)
Spotlight is a system-wide desktop search feature of Apple's Mac OS X operating system. Spotlight is a selection-based search system, which creates a virtual index of all items and files on the system. It is designed to allow the user to quickly locate a wide variety of items on the computer,...

) command in the Terminal.
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK