GitHub user sesuncedu opened a pull request: https://github.com/apache/commons-compress/pull/30
COMPRESS-407 - Validate Block and Record Sizes and use 512 blocks if none given. This PR includes the commits for COMPRESS-405 and COMPRESS-406. The new content is https://github.com/sesuncedu/commons-compress/commit/d754d8922a507da887aba70292aa650823a7a38c if cherry-picking. The rest of the block size changes will be all be based on here, since they become less separable You can merge this pull request into a Git repository by running: $ git pull https://github.com/sesuncedu/commons-compress COMPRESS-407 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/commons-compress/pull/30.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 #30 ---- 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> commit 85a22f05b934cf82ddf271d4d800a001738b55d5 Author: Simon Spero <sesunc...@gmail.com> Date: 2017-06-11T16:29:04Z Added License Headers for the rat Signed-off-by: Simon Spero <sesunc...@gmail.com> commit d754d8922a507da887aba70292aa650823a7a38c Author: Simon Spero <sesunc...@gmail.com> Date: 2017-06-11T22:48:42Z COMPRESS-407 Validate Block and Record Sizes Require block size >=0 that is multiple of 512 bytes. Use block size of 512 if one is not given. Require record size of 512 bytes. Deprecate constructors taking recordSize as parameter Modify tests to check for enforcement of record size == 512 Modify tests to check for correct overall length for different block sizes including PAX default, USTAR default, and unspecified. 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