Kapacity

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard

Coerces this capacity's exact byte count into a standard 32-bit Int suitable for memory allocation.

Functions

Link copied to clipboard
open operator override fun compareTo(other: Kapacity): Int
Link copied to clipboard
operator fun div(other: Kapacity): Long

Divides this Kapacity by another Kapacity.

operator fun div(divisor: Double): Kapacity
operator fun div(divisor: Float): Kapacity
operator fun div(divisor: Int): Kapacity
operator fun div(divisor: Long): Kapacity

Divides this capacity by a given scalar divisor. Ensures the resulting capacity is never negative.

Link copied to clipboard
operator fun minus(other: Kapacity): Kapacity

Subtracts another Kapacity from this one. Ensures the resulting capacity is never negative.

operator fun minus(bytes: Double): Kapacity
operator fun minus(bytes: Float): Kapacity
operator fun minus(bytes: Int): Kapacity
operator fun minus(bytes: Long): Kapacity

Subtracts the specified number of bytes from this capacity. Ensures the resulting capacity is never negative.

Link copied to clipboard
operator fun plus(other: Kapacity): Kapacity

Adds another Kapacity to this one. Ensures the resulting capacity is never negative.

operator fun plus(bytes: Double): Kapacity
operator fun plus(bytes: Float): Kapacity
operator fun plus(bytes: Int): Kapacity
operator fun plus(bytes: Long): Kapacity

Adds the specified number of bytes to this capacity. Ensures the resulting capacity is never negative.

Link copied to clipboard
operator fun times(factor: Double): Kapacity
operator fun times(factor: Float): Kapacity
operator fun times(bytes: Int): Kapacity
operator fun times(factor: Long): Kapacity

Multiplies this capacity by a given scalar factor. Ensures the resulting capacity is never negative.

Link copied to clipboard
fun Kapacity.toArray(init: (Int) -> Byte = { 0 }): Array<Byte>

Allocates a new boxed Array of Byte with a size equal to this capacity.

Link copied to clipboard
fun Kapacity.toArrayUnsigned(init: (Int) -> UByte = { 0U }): Array<UByte>

Allocates a new boxed Array of UByte with a size equal to this capacity.

Link copied to clipboard

Allocates a new primitive ByteArray with a size equal to this capacity.

Link copied to clipboard
open override fun toString(): String
fun toString(unit: KapacityUnit? = null, useMetric: Boolean = true, useUnitSuffix: Boolean = true, useAbbreviation: Boolean = true): String
Link copied to clipboard

Allocates a new primitive UByteArray with a size equal to this capacity.