Works like a charm with a `ForwardingSink` ```pri...
# squarelibraries
c
Works like a charm with a
ForwardingSink
Copy code
private class UnclosingSink(output: OutputStream) : ForwardingSink(output.sink()) {
  override fun close() {
    delegate.flush()
  }
}
Copy code
fun getEncryptedSink(output: OutputStream): Sink {
  val cipher = getEncryptionCipher()
  return UnclosingSink(output).buffer()
      .writeInt(cipher.iv.size)
      .write(cipher.iv)
      .cipherSink(cipher)
}
👍 1