ByteArraySource

class ByteArraySource(data: ByteArray, index: Int = 0, size: Int = data.size) : Source<ByteArraySink> (source)

Constructors

Link copied to clipboard
constructor(data: ByteArray, index: Int = 0, size: Int = data.size)

Functions

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(): ByteArraySource

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 skip(nBytes: Long)
Link copied to clipboard
open override fun transferTo(sink: ByteArraySink): 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.