ContentType

class ContentType : HeaderValueWithParameters

Represents a value for a Content-Type header.

Constructors

Link copied to clipboard
fun ContentType(contentType: String, contentSubtype: String, parameters: List<HeaderValueParam> = emptyList())

Types

Link copied to clipboard
object Application

Provides a list of standard subtypes of an application content type.

Link copied to clipboard
object Audio

Provides a list of standard subtypes of an audio content type.

Link copied to clipboard
object Companion
Link copied to clipboard
object Image

Provides a list of standard subtypes of an image content type.

Link copied to clipboard
object Message

Provides a list of standard subtypes of a message content type.

Link copied to clipboard
object MultiPart

Provides a list of standard subtypes of a multipart content type.

Link copied to clipboard
object Text

Provides a list of standard subtypes of a text content type.

Link copied to clipboard
object Video

Provides a list of standard subtypes of a video content type.

Functions

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 match(pattern: ContentType): Boolean
fun match(pattern: String): Boolean

Checks if this type matches a pattern type taking into account placeholder symbols * and parameters.

Link copied to clipboard
fun parameter(name: String): String?

The first value for the parameter with name comparing case-insensitively or null if no such parameters found

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

Creates a copy of this type without any parameters

Link copied to clipboard
fun withParameter(name: String, value: String): ContentType

Creates a copy of this type with the added parameter with the name and value.

Properties

Link copied to clipboard
val contentSubtype: String

represents a subtype part of the media type.

Link copied to clipboard
val contentType: String

represents a type part of the media type.

Link copied to clipboard
val parameters: List<HeaderValueParam>

Extensions

Link copied to clipboard
fun ContentType.fileExtensions(): List<String>

Recommended file name extensions for this content type

Link copied to clipboard
fun ContentType.withCharset(charset: Charset): ContentType

Creates a copy of this type with the added charset parameter with charset value.

Link copied to clipboard
fun ContentType.withCharsetIfNeeded(charset: Charset): ContentType

Creates a copy of this type with the added charset parameter with charset value if ContentType is not ignored