Feed

abstract inner class Feed : EncoderDecoder.Feed<C> (source)

Data to encode is fed into consume and, as the Encoder.Feed's buffer fills, encoded data is output to the supplied Encoder.OutFeed. This allows for a "lazy" encode, or streaming of encoded data.

Once all data has been fed through consume, call doFinal to process remaining data in the Encoder.Feed buffer. Alternatively, utilize the use extension function (highly recommended) which will call doFinal (or close if there was an error with encoding) for you.

See also

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
override fun close()

Closes the feed rendering it useless.

Link copied to clipboard
fun consume(input: Byte)

Updates the Encoder.Feed with a new byte to encode.

Link copied to clipboard
protected abstract fun consumeProtected(input: Byte)
Link copied to clipboard
protected abstract override fun doFinalProtected()

Implementations should perform final operations on their buffered input, AND reset any stateful variables they may have. This is called by both flush and doFinal.

Link copied to clipboard
override fun flush()

Flushes the buffered input and performs any final encoding operations without closing the Feed.

Link copied to clipboard
override fun isClosed(): Boolean