Add OutputStream.getWritableBytes(n)

This commit is contained in:
Zahary Karadjov 2022-01-22 19:02:41 +02:00
commit 5a7d1d196f
No known key found for this signature in database
GPG key ID: C8936F8A3073D609
3 changed files with 70 additions and 6 deletions

View file

@ -473,6 +473,10 @@ bytes before continuing. The rationale here is that introducing an interruption
point at every `write` produces less optimal code, but if this is desired you
can use the `stream.writeAndWait` API.
If you have existing algorithms that output data to an `openArray`, you can use
the `stream.getWritableBytes` API to continue using them without introducing any
intermediate buffers.
#### Delayed Writes
Many protocols and formats employ fixed-size and variable-size length prefixes