commonMain.io.ktor.util.Bytes.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ktor-utils-tvosx64 Show documentation
Show all versions of ktor-utils-tvosx64 Show documentation
Ktor is a framework for quickly creating web applications in Kotlin with minimal effort.
The newest version!
/*
* Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/
package io.ktor.util
import io.ktor.utils.io.*
/**
* Read [Short] in network order(BE) with specified [offset] from [ByteArray].
*/
@InternalAPI
public fun ByteArray.readShort(offset: Int): Short {
val result = ((this[offset].toInt() and 0xFF) shl 8) or (this[offset + 1].toInt() and 0xFF)
return result.toShort()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy