MediaType

class MediaType

An RFC 2045 Media Type, appropriate to describe the content type of an HTTP request or response body.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
@get:JvmName(name = "subtype")
val subtype: String

Returns a specific media subtype, such as "plain" or "png", "mpeg", "mp4" or "xml".

Link copied to clipboard
@get:JvmName(name = "type")
val type: String

Returns the high-level media type, such as "text", "image", "audio", "video", or "application".

Functions

Link copied to clipboard
fun charset(defaultValue: Charset? = null): Charset?

Returns the charset of this media type, or defaultValue if either this media type doesn't specify a charset, or if its charset is unsupported by the current runtime.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
fun parameter(name: String): String?

Returns the parameter name of this media type, or null if this media type does not define such a parameter.

Link copied to clipboard
open override fun toString(): String

Returns the encoded media type, like "text/plain; charset=utf-8", appropriate for use in a Content-Type header.