Map of known MIME types

Introduced properties

fun [](ext: String): nullable String

nitcorn :: MediaTypes :: []

Get the type/subtype associated to a file extension ext
protected fun types: HashMap[String, String]

nitcorn :: MediaTypes :: types

MIME types by extensions.
protected fun types=(types: HashMap[String, String])

nitcorn :: MediaTypes :: types=

MIME types by extensions.

Redefined properties

redef type SELF: MediaTypes

nitcorn $ MediaTypes :: SELF

Type of this instance, automatically specialized in every class
redef init init

nitcorn $ MediaTypes :: init

All properties

fun !=(other: nullable Object): Bool

core :: Object :: !=

Have self and other different values?
fun ==(other: nullable Object): Bool

core :: Object :: ==

Have self and other the same value?
type CLASS: Class[SELF]

core :: Object :: CLASS

The type of the class of self.
type SELF: Object

core :: Object :: SELF

Type of this instance, automatically specialized in every class
fun [](ext: String): nullable String

nitcorn :: MediaTypes :: []

Get the type/subtype associated to a file extension ext
protected fun class_factory(name: String): CLASS

core :: Object :: class_factory

Implementation used by get_class to create the specific class.
fun class_name: String

core :: Object :: class_name

The class name of the object.
fun get_class: CLASS

core :: Object :: get_class

The meta-object representing the dynamic type of self.
fun hash: Int

core :: Object :: hash

The hash code of the object.
init init

core :: Object :: init

fun inspect: String

core :: Object :: inspect

Developer readable representation of self.
protected fun inspect_head: String

core :: Object :: inspect_head

Return "CLASSNAME:#OBJECTID".
intern fun is_same_instance(other: nullable Object): Bool

core :: Object :: is_same_instance

Return true if self and other are the same instance (i.e. same identity).
fun is_same_serialized(other: nullable Object): Bool

core :: Object :: is_same_serialized

Is self the same as other in a serialization context?
intern fun is_same_type(other: Object): Bool

core :: Object :: is_same_type

Return true if self and other have the same dynamic type.
intern fun object_id: Int

core :: Object :: object_id

An internal hash code for the object based on its identity.
fun output

core :: Object :: output

Display self on stdout (debug only).
intern fun output_class_name

core :: Object :: output_class_name

Display class name on stdout (debug only).
fun serialization_hash: Int

core :: Object :: serialization_hash

Hash value use for serialization
intern fun sys: Sys

core :: Object :: sys

Return the global sys object, the only instance of the Sys class.
abstract fun to_jvalue(env: JniEnv): JValue

core :: Object :: to_jvalue

fun to_s: String

core :: Object :: to_s

User readable representation of self.
protected fun types: HashMap[String, String]

nitcorn :: MediaTypes :: types

MIME types by extensions.
protected fun types=(types: HashMap[String, String])

nitcorn :: MediaTypes :: types=

MIME types by extensions.
package_diagram nitcorn::MediaTypes MediaTypes core::Object Object nitcorn::MediaTypes->core::Object

Parents

interface Object

core :: Object

The root of the class hierarchy.

Class definitions

nitcorn $ MediaTypes
# Map of known MIME types
class MediaTypes

	# MIME types by extensions.
	protected var types = new HashMap[String, String]

	# Get the type/subtype associated to a file extension `ext`
	fun [](ext: String): nullable String
	do
		if types.keys.has(ext) then return types[ext]
		return null
	end

	init
	do
		types["html"]       = "text/html"
		types["htm"]        = "text/html"
		types["shtml"]      = "text/html"
		types["css"]        = "text/css"
		types["csv"]        = "text/csv"
		types["xml"]        = "text/xml"
		types["rss"]        = "text/xml"
		types["gif"]        = "image/gif"
		types["jpg"]        = "image/jpeg"
		types["jpeg"]       = "image/jpeg"
		types["js"]         = "application/x-javascript"
		types["txt"]        = "text/plain"
		types["htc"]        = "text/x-component"
		types["mml"]        = "text/mathml"
		types["png"]        = "image/png"
		types["ico"]        = "image/x-icon"
		types["jng"]        = "image/x-jng"
		types["wbmp"]       = "image/vnd.wap.wbmp"
		types["gz"]         = "application/gzip"
		types["jar"]        = "application/java-archive"
		types["war"]        = "application/java-archive"
		types["ear"]        = "application/java-archive"
		types["json"]       = "application/json"
		types["hqx"]        = "application/mac-binhex40"
		types["pdf"]        = "application/pdf"
		types["cco"]        = "application/x-cocoa"
		types["jardiff"]    = "application/x-java-archive-diff"
		types["jnlp"]       = "application/x-java-jnlp-file"
		types["run"]        = "application/x-makeself"
		types["pl"]         = "application/x-perl"
		types["pm"]         = "application/x-perl"
		types["pdb"]        = "application/x-pilot"
		types["prc"]        = "application/x-pilot"
		types["rar"]        = "application/x-rar-compressed"
		types["rpm"]        = "application/x-redhat-package-manager"
		types["sea"]        = "application/x-sea"
		types["swf"]        = "application/x-shockwave-flash"
		types["sit"]        = "application/x-stuffit"
		types["tcl"]        = "application/x-tcl"
		types["tk"]         = "application/x-tcl"
		types["der"]        = "application/x-x509-ca-cert"
		types["pem"]        = "application/x-x509-ca-cert"
		types["crt"]        = "application/x-x509-ca-cert"
		types["xpi"]        = "application/x-xpinstall"
		types["zip"]        = "application/zip"
		types["deb"]        = "application/octet-stream"
		types["bin"]        = "application/octet-stream"
		types["exe"]        = "application/octet-stream"
		types["dll"]        = "application/octet-stream"
		types["dmg"]        = "application/octet-stream"
		types["eot"]        = "application/octet-stream"
		types["iso"]        = "application/octet-stream"
		types["img"]        = "application/octet-stream"
		types["msi"]        = "application/octet-stream"
		types["msp"]        = "application/octet-stream"
		types["msm"]        = "application/octet-stream"
		types["mp3"]        = "audio/mpeg"
		types["ra"]         = "audio/x-realaudio"
		types["mpeg"]       = "video/mpeg"
		types["mpg"]        = "video/mpeg"
		types["mov"]        = "video/quicktime"
		types["flv"]        = "video/x-flv"
		types["avi"]        = "video/x-msvideo"
		types["wmv"]        = "video/x-ms-wmv"
		types["asx"]        = "video/x-ms-asf"
		types["asf"]        = "video/x-ms-asf"
		types["mng"]        = "video/x-mng"
		types["apk"]        = "application/vnd.android.package-archive"
		types["svg"]        = "image/svg+xml"
		types["ttf"]        = "application/x-font-ttf"
		types["otf"]        = "application/x-font-opentype"
		types["eof"]        = "application/vnd.ms-fontobject"
		types["woff"]       = "application/font-woff"
		types["woff2"]      = "application/font-woff2"
	end
end
lib/nitcorn/media_types.nit:21,1--111,3