ContentType

class ContentType : HeaderValueWithParameters

Represents a value for a Content-Type header.

Constructors

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

Types

Application
Link copied to clipboard
common
object Application
Provides a list of standard subtypes of an application content type.
Audio
Link copied to clipboard
common
object Audio
Provides a list of standard subtypes of an audio content type.
Companion
Link copied to clipboard
common
object Companion
Image
Link copied to clipboard
common
object Image
Provides a list of standard subtypes of an image content type.
Message
Link copied to clipboard
common
object Message
Provides a list of standard subtypes of a message content type.
MultiPart
Link copied to clipboard
common
object MultiPart
Provides a list of standard subtypes of a multipart content type.
Text
Link copied to clipboard
common
object Text
Provides a list of standard subtypes of a text content type.
Video
Link copied to clipboard
common
object Video
Provides a list of standard subtypes of a video content type.

Functions

equals
Link copied to clipboard
common
open operator override fun equals(other: Any?): Boolean
hashCode
Link copied to clipboard
common
open override fun hashCode(): Int
match
Link copied to clipboard
common
fun match(pattern: ContentType): Boolean
Checks if this type matches a pattern type taking into account placeholder symbols * and parameters.
fun match(pattern: String): Boolean
Checks if this type matches a pattern type taking into account placeholder symbols * and parameters.
parameter
Link copied to clipboard
common
fun parameter(name: String): String?
The first value for the parameter with name comparing case-insensitively or null if no such parameters found
toString
Link copied to clipboard
common
open override fun toString(): String
withoutParameters
Link copied to clipboard
common
fun withoutParameters(): ContentType
Creates a copy of this type without any parameters
withParameter
Link copied to clipboard
common
fun withParameter(name: String, value: String): ContentType
Creates a copy of this type with the added parameter with the name and value.

Properties

contentSubtype
Link copied to clipboard
common
val contentSubtype: String
represents a subtype part of the media type.
contentType
Link copied to clipboard
common
val contentType: String
represents a type part of the media type.
parameters
Link copied to clipboard
common
val parameters: List<HeaderValueParam>

Extensions

fileExtensions
Link copied to clipboard
common
fun ContentType.fileExtensions(): List<String>
Recommended file name extensions for this content type
withCharset
Link copied to clipboard
common
fun ContentType.withCharset(charset: Charset): ContentType
Creates a copy of this type with the added charset parameter with charset value.