chris-horner
11/12/2020, 3:18 AMForwardingSink
private class UnclosingSink(output: OutputStream) : ForwardingSink(output.sink()) {
override fun close() {
delegate.flush()
}
}
fun getEncryptedSink(output: OutputStream): Sink {
val cipher = getEncryptionCipher()
return UnclosingSink(output).buffer()
.writeInt(cipher.iv.size)
.write(cipher.iv)
.cipherSink(cipher)
}