I am trying to find elegant way to convert OutputStream
produced by bitmap.compress(Bitmap.CompressFormat.PNG, 100, outStream)
method to Okio's Source
/ InputStream
(needed to further manipulate data - encoding) while maintaining the data buffer.
I tried using
val pipe = Pipe(100)
bitmap.compress(Bitmap.CompressFormat.PNG, 100, Okio.buffer(pipe.sink()).outputStream())
saveFile(File("filename"), pipe.source())
but this hangs on bitmap.compress
.