ByteArrayBuffer

Constructors

Link copied to clipboard
constructor(initialCapacity: Int = 32)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open override fun appendUnsafe(bytes: ByteArray, startIndex: Int, endIndex: Int): Int

Directly appends bytes to this Sink's internal Buffer without copying. Thus, it keeps bytes managed by a Buffer accessible. The bytes may be overwritten through the Buffer or even recycled to be used by another buffer. Therefore, operating on these bytes after wrapping leads to undefined behaviour. startIndex is inclusive, endIndex is exclusive.

Link copied to clipboard
open override fun clear()
Link copied to clipboard

Decodes an ASN.1 unsigned varint to a Asn1Integer, copying all bytes from the source into a ByteArray.

Link copied to clipboard

Decodes an ASN.1 unsigned varint to an UInt, copying all bytes from the source into a ByteArray.

Link copied to clipboard

Decodes an ASN.1 unsigned varint to an ULong, copying all bytes from the source into a ByteArray.

Link copied to clipboard
open override fun exhausted(): Boolean
Link copied to clipboard
open override fun peek(): Buffer

Returns a new Source that can read data from this source without consuming it. The returned source becomes invalid once this source is next read or closed.

Link copied to clipboard

Decodes a single Asn1Element from this source.

Link copied to clipboard
Link copied to clipboard
open override fun readByte(): Byte
Link copied to clipboard
open override fun readByteArray(nBytes: Int): ByteArray
Link copied to clipboard

Reads all parsable ASN.1 elements from this source.

Link copied to clipboard

Consumes exactly nBytes from this source and interprets it as a signed Int

Link copied to clipboard

Consumes exactly nBytes from this source and interprets it as a Long.

Link copied to clipboard

Consumes exactly nBytes remaining data from this source and interprets it as a UInt

Link copied to clipboard

Consumes exactly nBytes from this source and interprets it as a signed ULong.

Link copied to clipboard
inline fun Source<*>.readUByte(): UByte
Link copied to clipboard
open override fun remaining(): Int
Link copied to clipboard
open override fun size(): Int
Link copied to clipboard
open override fun skip(nBytes: Long)
Link copied to clipboard
open override fun toByteArray(): ByteArray
Link copied to clipboard
open override fun transferTo(sink: Buffer): Long

Removes all bytes from this source, writes them to sink, and returns the total number of bytes written to sink. Return 0 if this source is exhausted.

Link copied to clipboard
open override fun write(bytes: ByteArray, startIndex: Int, endIndex: Int)
Link copied to clipboard

Encodes this number using varint encoding as used within ASN.1: groups of seven bits are encoded into a byte, while the highest bit indicates if more bytes are to come

Encodes this number using varint encoding as used within ASN.1: groups of seven bits are encoded into a byte, while the highest bit indicates if more bytes are to come

Link copied to clipboard
open override fun writeByte(byte: Byte)
Link copied to clipboard

Encodes a positive Long to a minimum-size unsigned byte array, omitting the leading zero

Link copied to clipboard

Writes a signed long using twos-complement encoding using the fewest bytes required

Link copied to clipboard

Encodes an unsigned Int to a minimum-size twos-complement byte array

Link copied to clipboard

Encodes an unsigned Long to a minimum-size twos-complement byte array

Link copied to clipboard
inline fun Sink.writeUByte(uByte: UByte)