Package io.ktor.util
Types
object Stub implementation that always fails. Will be removed so no public signatures should rely on it |
|
class AttributeKey<T> Specifies a key for an attribute in Attributes |
|
interface Attributes Map of attributes accessible by AttributeKey in a typed manner |
|
class CaseInsensitiveMap<Value> : MutableMap<String, Value> A map with case insensitive String keys |
|
class CaseInsensitiveSet : MutableSet<String> |
|
interface ConversionService Data conversion service that does serialization and deserialization to/from list of strings |
|
This is an internal implementation for copy-on-write concurrent map. It is very limited since it is not intended as general purpose implementation. |
|
object DefaultConversionService : ConversionService The default conversion service that supports only basic types and enums |
|
interface Digest Stateful digest class specified to calculate digest. |
|
class DispatcherWithShutdown : CoroutineDispatcher Specialized dispatcher useful for graceful shutdown |
|
interface Encoder Content encoder. |
|
object GenerateOnlyNonceManager : NonceManager This implementation does only generate nonce values but doesn’t validate them. This is recommended for testing only. |
|
object Hash |
|
object Identity : Encoder Empty Encoder that doesn’t do any changes. |
|
expect class Lock |
|
interface NonceManager Represents a nonce manager. It’s responsibility is to produce nonce values and verify nonce values from untrusted sources that they are provided by this manager. This is usually required in web environment to mitigate CSRF attacks. Depending on it’s underlying implementation it could be stateful or stateless. Note that there is usually some timeout for nonce values to reduce memory usage and to avoid replay attacks. Nonce length is unspecified. |
|
expect object PlatformUtils |
|
class StatelessHmacNonceManager : NonceManager Stateless nonce manager implementation with HMAC verification and timeout. Every nonce provided by this manager consist of a random part, timestamp and HMAC. |
|
interface StringValues Provides data structure for associating a String with a List of Strings |
|
open class StringValuesBuilder |
|
open class StringValuesImpl : StringValues |
|
open class StringValuesSingleImpl : StringValues |
Annotations
annotation class InternalAPI API marked with this annotation is ktor internal and it is not intended to be used outside. It could be modified or removed without any notice. Using it outside of ktor could cause undefined behaviour and/or any strange effects. |
|
annotation class KtorExperimentalAPI API marked with this annotation is experimental and is not guaranteed to be stable. |
|
annotation class PublicAPICandidate API marked with this annotation is intended to become public in the future version. Usually it means that the API can’t be public at the moment of development due to compatibility guarantees restrictions. |
Exceptions
class DataConversionException : Exception Thrown when failed to convert value |
Extensions for External Classes
Properties
val Deflate: Encoder Implementation of Deflate Encoder. |
|
val GZip: Encoder Implementation of GZip Encoder. |
|
val GreenwichMeanTime: ZoneId ZoneId for GMT |
Functions
expect fun Attributes( Create attributes instance suitable for the particular platform |
|
fun SilentSupervisor(parent: Job? = null): <ERROR CLASS> Supervisor with empty coroutine exception handler ignoring all exceptions. |
|
fun StringValuesBuilder.appendAll( Append all values from the specified builder |
|
fun StringValuesBuilder.appendFiltered( Append values from source filtering values by the specified predicate |
|
fun Input.asStream(): InputStream Convert io.ktor.utils.io Input to java InputStream |
|
Calculate digest from current state and specified bytes. Calculate digest from current state and specified string. |
|
fun <Value> caseInsensitiveMap(): MutableMap<String, Value> Create an instance of case insensitive mutable map. For internal use only. |
|
fun ByteReadChannel.copyToBoth( Copy source channel to both output channels chunk by chunk. |
|
Create a new instance of thread safe LRUCache and return it. |
|
fun ByteReadPacket. |
|
fun ByteReadPacket.decodeBase64Bytes(): Input Decode ByteReadPacket from base64 format |
|
fun ByteReadChannel.deflated( fun ByteWriteChannel.deflated( Launch a coroutine on coroutineContext that does deflate compression
optionally doing CRC and writing GZIP header and trailer if gzip = |
|
fun ByteReadPacket.encodeBase64(): String Encode ByteReadPacket in base64 format |
|
fun StringValues.filter( Create a new instance of StringValues filtered by the specified predicate |
|
fun StringValues.flattenEntries(): List<Pair<String, String>> Copy values to a list of pairs |
|
fun StringValues.flattenForEach( Invoke block function for every value pair |
|
expect fun generateNonce(): String Generates a nonce string. Could block if the system’s entropy source is empty Generates a nonce bytes of size. Could block if the system’s entropy source is empty |
|
Create a digest function with the specified algorithm and salt Create a digest function with the specified algorithm and salt provider. |
|
fun Parameters.getOrFail(name: String): String Get parameters value associated with this name or fail with MissingRequestParameterException |
|
operator fun <R : Any> Parameters.getValue( Operator function that allows to delegate variables by call parameters. It does conversion to type R using DefaultConversionService |
|
Encode bytes as a HEX string with no spaces, newlines and Decode bytes from HEX string. It should be no spaces and |
|
Compute SHA-1 hash for the specified bytes |
|
fun ByteReadChannel.split( Split source ByteReadChannel into 2 new one. Cancel of one channel in split(input or both outputs) cancels other channels. |
|
suspend fun ByteReadChannel.toByteArray(): ByteArray Read channel to byte array. |
|
fun StringValues.toMap(): Map<String, List<String>> Copy values to a new independent map |
|
fun url(block: URLBuilder.() -> Unit): String Construct a URL fun ApplicationCall.url( Creates an url using current call’s schema, path and parameters as initial and then invokes block function on the url builder so amend parameters |
|
fun valuesOf( Build an instance of StringValues from a vararg list of pairs fun valuesOf( Build an instance of StringValues from a single pair fun valuesOf( Build an instance of StringValues with a single name and multiple values fun valuesOf(): StringValues Build an empty StringValues instance. fun valuesOf( Build an instance of StringValues from the specified map |
|
Companion Object Functions
fun URLBuilder.Companion.createFromCall( Creates an url using current call’s schema, path and parameters as initial |