jvmMain.kotlinx.io.streams.ByteArrays.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kotlinx-io-jvm Show documentation
Show all versions of kotlinx-io-jvm Show documentation
IO support libraries for Kotlin
package kotlinx.io.streams
import kotlinx.io.pool.*
internal const val ByteArrayPoolBufferSize = 4096
internal val ByteArrayPool = object : DefaultPool(128) {
final override fun produceInstance(): ByteArray {
return ByteArray(ByteArrayPoolBufferSize)
}
final override fun validateInstance(instance: ByteArray) {
require(instance.size == ByteArrayPoolBufferSize) { "Unable to recycle buffer of wrong size: ${instance.size} != 4096" }
super.validateInstance(instance)
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy