He-Pin opened a new pull request, #3146: URL: https://github.com/apache/pekko/pull/3146
### Motivation Seven GZIP `decompress` methods and one `streamToBytes` utility use manual `@tailrec` read loops with `buffer + read() + write()` to copy streams. JDK 9 provides `InputStream.transferTo()` and `readAllBytes()` which implement the same loop internally. ### Modification - Replace 7 identical `readChunk()` tail-recursive loops with `in.transferTo(out)` in `decompress` methods across: `cluster`, `cluster-sharding`, `cluster-tools`, `cluster-metrics`, `distributed-data`, `serialization-jackson`, `serialization-jackson3` - Replace `persistence` `streamToBytes` manual loop with `inputStream.readAllBytes()` - Remove unused `@tailrec` imports from 5 files - Remove unused `ByteArrayOutputStream` import from `package.scala` ### Result Net reduction of ~79 lines. Functionally identical — `transferTo` uses an internal 8192-byte buffer (vs original 4096) which only affects chunking granularity, not correctness. ### Tests - `sbt "distributed-data/compile" "cluster/compile" "cluster-tools/compile" "cluster-sharding/compile" "cluster-metrics/compile" "serialization-jackson/compile" "serialization-jackson3/compile" "persistence/compile"` — all passed ### References Refs #3136 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
