GitHub user sesuncedu opened a pull request: https://github.com/apache/commons-compress/pull/28
COMPRESS-405 Create Fixed Length Block OutputStream / WriteableByteChannel This PR provides a new class that is an OutputStream and WritableByteChannel, and which supports writing to a destination output stream or byte channel in fixed size blocks. Internally, all writes are made using NIO. If the destination is a FileOutputStream the existing channel is used. Other OutputStreams are wrapped with a custom channel implementation which does not attempt to split writes into chunks. If the target channel fails to write the entire buffer in a single call, an exception is thrown, Incoming data is accumulated in a ByteBuffer until a complete block is ready, then written to the target. If WritableByteChannel::write(ByteBuffer) method is called, the code will attempt to avoid copying data into the buffer if the buffer is empty, and a complete block is available. **The class and UnitTest are in compress/utils . This is a MINOR change - thus the version number for the package should be increated to 1.15.0** Signed-off-by: Simon Spero <sesunc...@gmail.com> You can merge this pull request into a Git repository by running: $ git pull https://github.com/sesuncedu/commons-compress COMPRESS-405 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/commons-compress/pull/28.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #28 ---- commit 7f051c9cfe047289045618db3327fca018a25daf Author: Simon Spero <sesunc...@gmail.com> Date: 2017-06-11T16:21:16Z COMPRESS-405 Create Fixed Length Block OutputStream / WriteableByteChannel This commit provides a new class that is an OutputStream and WritableByteChannel, and which supports writing to a destination output stream or byte channel in fixed size blocks. Internally, all writes are made using NIO. If the destination is a FileOutputStream the existing channel is used. Other OutputStreams are wrapped with a custom channel implementation which does not attempt to split writes into chunks. If the target channel fails to write the entire buffer in a single call, an exception is thrown, Incoming data is accumulated in a ByteBuffer until a complete block is ready, then written to the target. If WritableByteChannel::write(ByteBuffer) method is called, the code will attempt to avoid copying data into the buffer if the buffer is empty, and a complete block is available. The class and UnitTest are in compress/utils . This is a MINOR change - thus the version number for the package should be increated to 1.15.0. Signed-off-by: Simon Spero <sesunc...@gmail.com> ---- --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org