All Downloads are FREE. Search and download functionalities are using the official Maven repository.

kotlinx.io.streams.ByteArrays.kt Maven / Gradle / Ivy

There is a newer version: 0.1.16
Show newest version
package kotlinx.io.streams

import kotlinx.io.pool.*

internal val ByteArrayPool = object : DefaultPool(128) {
    final override fun produceInstance(): ByteArray {
        return ByteArray(4096)
    }

    final override fun validateInstance(instance: ByteArray) {
        require(instance.size == 4096) { "Unable to recycle buffer of wrong size: ${instance.size} != 4096" }
        super.validateInstance(instance)
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy