Packagevegas.net
Classpublic class MIME
InheritanceMIME Inheritance Object

Multipurpose Internet Mail Extensions (MIME), an Internet media type, originally called a MIME type after MIME and sometimes a Content-type after the name of a header in several protocols whose value is such a type, is a two-part identifier for file formats on the Internet. The identifiers were originally defined in RFC 2046 for use in e-mail sent through SMTP, but their use has expanded to other protocols such as HTTP and SIP.

See : http://www.iana.org/assignments/media-types/text/ and http://www.mimetype.org/

Example :

     import vegas.net.MIME ;
     
     trace( "MIME type 'video/mpeg' extensions : " + MIME.getExtensions("video/mpeg") ) ;
     trace( "MIME type of the htm extension    : " + MIME.getMimeTypeByExtension("htm") ) ;
     trace( "MIME type of the jar extension    : " + MIME.getMimeTypeByExtension("jar") ) ;
     
     trace( "---" ) ;
     
     trace( "All MIME types : "  + MIME.getMimeTypes() ) ;
     



Public Properties
 PropertyDefined By
  extensions : Array
[read-only] The set of all extensions of this MimeType.
MIME
  subType : String
The subType of the MIME type.
MIME
  type : String
The type of the MIME type.
MIME
Public Methods
 MethodDefined By
  
MIME(mimeType:String = null, extensions:Array = null)
Creates a new Mime instance.
MIME
  
addExtension(ext:String):Boolean
Add a new extension in the collection of all extensions of this MIME type.
MIME
  
addMimeType(mimeType:String, ... extensions):void
[static] Adds the specified mimeType in the dictionary of all MIME types and specified this extensions.
MIME
  
getExtensions(mimeType:String):Array
[static] Returns the Array representaiton of all extensions of the specified MIME type.
MIME
  
getMimeType(mimeType:String):MIME
[static] Returns the MIME representation of the specified mimeType expression.
MIME
  
[static] Returns the MIME representation of the specified mimeType expression.
MIME
  
getMimeTypes():Array
[static] Returns the MIME representation of the specified mimeType expression.
MIME
  
removeExtension(ext:String):Boolean
Removes an extension in the collection of all extensions of this MIME type.
MIME
  
toString():String
Returns the String representation of the object.
MIME
  
valueOf():String
Returns the real value of the object.
MIME
Public Constants
 ConstantDefined By
  TYPES : Dictionary
[static] The types dictionary of all MIME types.
MIME
Property Detail
extensionsproperty
extensions:Array  [read-only]

The set of all extensions of this MimeType.


Implementation
    public function get extensions():Array
subTypeproperty 
public var subType:String

The subType of the MIME type.

typeproperty 
public var type:String

The type of the MIME type.

Constructor Detail
MIME()Constructor
public function MIME(mimeType:String = null, extensions:Array = null)

Creates a new Mime instance.

Parameters
mimeType:String (default = null) — The MIME type expression to register.
 
extensions:Array (default = null) — The optional Array representation of all extensions of this MIME type.
Method Detail
addExtension()method
public function addExtension(ext:String):Boolean

Add a new extension in the collection of all extensions of this MIME type.

Parameters

ext:String

Returns
Booleantrue if the extension is inserted in the collection of all extensions.
addMimeType()method 
public static function addMimeType(mimeType:String, ... extensions):void

Adds the specified mimeType in the dictionary of all MIME types and specified this extensions.

Parameters

mimeType:String
 
... extensions

getExtensions()method 
public static function getExtensions(mimeType:String):Array

Returns the Array representaiton of all extensions of the specified MIME type.

Parameters

mimeType:String

Returns
Array — the Array representaiton of all extensions of the specified MIME type.
getMimeType()method 
public static function getMimeType(mimeType:String):MIME

Returns the MIME representation of the specified mimeType expression.

Parameters

mimeType:String

Returns
MIME — the MIME representation of the specified mimeType expression.
getMimeTypeByExtension()method 
public static function getMimeTypeByExtension(ext:String):MIME

Returns the MIME representation of the specified mimeType expression.

Parameters

ext:String

Returns
MIME — the MIME representation of the specified mimeType expression.
getMimeTypes()method 
public static function getMimeTypes():Array

Returns the MIME representation of the specified mimeType expression.

Returns
Array — the MIME representation of the specified mimeType expression.
removeExtension()method 
public function removeExtension(ext:String):Boolean

Removes an extension in the collection of all extensions of this MIME type.

Parameters

ext:String

Returns
Booleantrue if the extension is removed.
toString()method 
public function toString():String

Returns the String representation of the object.

Returns
String — the String representation of the object.
valueOf()method 
public function valueOf():String

Returns the real value of the object.

Returns
String — the real value of the object.
Constant Detail
TYPESConstant
public static const TYPES:Dictionary

The types dictionary of all MIME types.