newEncoderFeed
Creates a new Encoder.Feed, outputting encoded data to the supplied Encoder.OutFeed.
e.g.
val sb = StringBuilder()
myEncoder.newEncoderFeed { encodedChar ->
sb.append(encodedChar)
}.use { feed ->
"Hello World!"
.encodeToByteArray()
.forEach { b -> feed.consume(b) }
}
println(sb.toString())
Content copied to clipboard