Package-level declarations

Properties

Link copied to clipboard

Returns an estimate of the number of bytes that can be read (or skipped over) from this InputStream without blocking, safely wrapped as a Kapacity instance.

Link copied to clipboard

Returns the Kapacity of this File, calculated directly from its length on the disk.

Returns the Kapacity of this ByteBuffer, calculated directly from its length on the disk.

Returns the Kapacity of this Path, calculated directly from its length on the disk.

val Buffer.kapacity: Kapacity

Returns the Kapacity of this Buffer, calculated directly from its size.

val ByteString.kapacity: Kapacity

Returns the Kapacity of this immutable ByteString, calculated directly from its size.

val ByteStringBuilder.kapacity: Kapacity

Returns the Kapacity of the data currently written to this ByteStringBuilder, calculated directly from its current size.

val NSData.kapacity: Kapacity

Returns the Kapacity of this NSData buffer, calculated directly from its length in memory.

val NSURL.kapacity: Kapacity

Returns the Kapacity of this NSURL, calculated directly from its file size on the disk.

Functions

Link copied to clipboard

Allocates a new standard (heap-backed) ByteBuffer with a capacity equal to this Kapacity.

Link copied to clipboard

Allocates a new direct (off-heap) ByteBuffer with a capacity equal to this Kapacity.

Link copied to clipboard
fun ByteBuffer.get(destination: ByteArray, destinationOffset: Int = 0, kapacity: Kapacity): ByteBuffer

Reads up to the specified kapacity of bytes from this buffer into the destination array.

Link copied to clipboard
fun ByteBuffer.put(source: ByteArray, sourceOffset: Int = 0, kapacity: Kapacity): ByteBuffer

Writes up to the specified kapacity of bytes from the source array into this buffer.

Link copied to clipboard
fun InputStream.read(destination: ByteArray, destinationOffset: Int = 0, kapacity: Kapacity): Int

Reads up to the specified kapacity of bytes from this input stream into the given destination array.

Link copied to clipboard
fun Buffer.readAtMostTo(sink: Buffer, kapacity: Kapacity): Kapacity

Removes up to the specified kapacity of bytes from this buffer and appends them to the sink.

fun Buffer.readAtMostTo(sink: ByteArray, startIndex: Int = 0, kapacity: Kapacity): Kapacity

Removes up to the specified kapacity of bytes from this buffer and writes them into the provided sink array.

Link copied to clipboard
fun InputStream.readKapacity(destination: ByteArray, destinationOffset: Int = 0, kapacity: Kapacity): Kapacity

Reads up to the specified kapacity of bytes from this input stream into the given destination array, returning the result as a Kapacity instance.

Link copied to clipboard
fun Buffer.readTo(sink: RawSink, kapacity: Kapacity)

Removes exactly the specified kapacity of bytes from this buffer and appends them to the sink.

Link copied to clipboard
fun Buffer.skip(kapacity: Kapacity)

Removes and discards the exact number of bytes represented by the given kapacity from this buffer.

Link copied to clipboard
fun ByteString.substring(startIndex: Int = 0, kapacity: Kapacity): ByteString

Returns a new ByteString containing a subset of bytes from this instance, starting at the startIndex and capturing up to the specified kapacity.

Link copied to clipboard
fun Kapacity.toNSData(): NSData

Allocates a new native Apple NSData buffer initialized with zeros, sized exactly to this Kapacity.

Link copied to clipboard
fun Kapacity.toNSMutableData(): NSMutableData

Allocates a new native Apple NSMutableData buffer initialized with zeros, sized exactly to this Kapacity.

Link copied to clipboard
fun OutputStream.write(source: ByteArray, sourceOffset: Int = 0, kapacity: Kapacity)

Writes up to the specified kapacity of bytes from the source array to this output stream.

fun Buffer.write(source: RawSource, kapacity: Kapacity)

Appends exactly the specified kapacity of bytes from the source into this buffer.

fun Buffer.write(source: ByteArray, startIndex: Int = 0, kapacity: Kapacity)

Appends the specified kapacity of bytes from the source array into this buffer.