Data Flavors

Different applications understand data differently, even the same kind of data. For example most word processors support some form of formatted text with different fonts, styles, sizes and so on. However Microsoft Word 6.0 for the Mac is not able to read formatted text produced by ClarisWorks and vice versa. Pictures from Photoshop can be copied and pasted into many programs, but the layers tend to get flattened when you do that.

The clipboard only really understands raw bytes. It does not inherently know how whether those bytes are text or a picture or a table or something else. The java.awt.datatransfer.DataFlavor class uses MIME types and subtypes to identify the kind of data stored in the clipboard.

MIME, the Multipurpose Internet Mail Extensions, is an Internet standard defined in RFCs 2045 through 2049 for transferring multimedia, binary data through 7-bit ASCII email. RFC 2046 in particular specifies the MIME type system and defines the base set of media types. New MIME types are registered with and approved by the Internet Assigned Numbers Authority (IANA). The current list of standardized types is available from ftp://ftp.isi.edu/in-notes/iana/assignments/media-types/media-types.

A MIME type has a type and a subtype. For example, text/plain, application/x-java-serialized-object, or image/gif. There are five defined types: text, image, audio, video, multipart, message, model, and application. The first seven are self-explanatory. The last is used for arbitrary binary data. Subtypes that begin with an x such as "x-java-serialized-object" are unofficial, application specific extensions. Two different programs are not guaranteed to interpret the same x type as representing the same kind of data.


Previous | Next | Top | Cafe au Lait

Copyright 1997, 1999 Elliotte Rusty Harold
elharo@metalab.unc.edu
Last Modified April 22, 1999