Feed
The base abstraction for Decoder.Feed and Encoder.Feed.
Feeds are meant to be single use disposables for the given encoding/decoding operation.
TLDR; Feeds only care about Bytes and Chars, not the medium for which they come from or are going to. Use the use extension function.
Their primary use case is for breaking the process of encoding and decoding into their individual parts. This allows for input and output type transformations to occur at the call site, instead of within the encoding/decoding process.
After a Feed consumes all the data you have for it via Decoder.Feed.consume/Encoder.Feed.consume, call doFinal to complete the encoding/decoding operation.
Alternatively, utilize the use extension function (highly recommended) which will call doFinal (or close if there was an error with the operation) for you.
If encoding/decoding multiple chunks of data (e.g. encoding 2 ByteArrays and concatenating them with a separator character), you can call flush between chunks to perform final operations on that chunk without closing the Feed.
See also
Inheritors
Functions
closes the Decoder.Feed/Encoder.Feed and finalizes the encoding/decoding, such as applying padding (encoding), or processing remaining data in its buffer before dumping them to Decoder.OutFeed/Encoder.OutFeed.