Return-Path: X-Original-To: apmail-commons-commits-archive@minotaur.apache.org Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8465C187A1 for ; Wed, 3 Feb 2016 14:33:38 +0000 (UTC) Received: (qmail 43862 invoked by uid 500); 3 Feb 2016 14:33:04 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 43779 invoked by uid 500); 3 Feb 2016 14:33:03 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 43770 invoked by uid 99); 3 Feb 2016 14:33:03 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Feb 2016 14:33:03 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 92C9DDFC8F; Wed, 3 Feb 2016 14:33:03 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: tcurdt@apache.org To: commits@commons.apache.org Message-Id: <784c3721b48b49c8be406fb0499f3f37@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: commons-compress git commit: Added buffering for random access which speeds up 7Z support. (by Dawid Weiss) Date: Wed, 3 Feb 2016 14:33:03 +0000 (UTC) Repository: commons-compress Updated Branches: refs/heads/master 1fb42987d -> b67a14697 Added buffering for random access which speeds up 7Z support. (by Dawid Weiss) fixes https://github.com/apache/commons-compress/pull/7 Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/b67a1469 Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/b67a1469 Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/b67a1469 Branch: refs/heads/master Commit: b67a14697fcf363bc2d7f18407e51b12ca05c1a9 Parents: 1fb4298 Author: Torsten Curdt Authored: Wed Feb 3 15:32:11 2016 +0100 Committer: Torsten Curdt Committed: Wed Feb 3 15:32:11 2016 +0100 ---------------------------------------------------------------------- src/changes/changes.xml | 87 ++++++++++---------- .../compress/archivers/sevenz/SevenZFile.java | 7 +- 2 files changed, 50 insertions(+), 44 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-compress/blob/b67a1469/src/changes/changes.xml ---------------------------------------------------------------------- diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 6bc1df2..80f49d0 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -44,6 +44,9 @@ The type attribute can be add,update,fix,remove. + + Added buffering for random access which speeds up 7Z support. + The checksum validation of TararchiveEntry is now as strict as the validation of GNU tar, which eliminates a few cases of @@ -92,15 +95,15 @@ The type attribute can be add,update,fix,remove. BZip2CompressorInputStream read fewer bytes than possible from a truncated stream. - + SevenZFile failed claiming the dictionary was too large when archives used LZMA compression for headers and content and @@ -354,33 +357,33 @@ This also changes the superclass of ZCompressorInputStream. SevenZOutputFile#closeArchiveEntry throws an exception when using LZMA2 compression on Java8. - + Read-Only support for Snappy compression. - + 7z reading of big 64bit values could be wrong. - + Read-Only support for .Z compressed files. - + ZipFile and ZipArchiveInputStream now support reading entries compressed using the SHRINKING method. - + TarArchiveInputStream could fail to read an archive completely. - + The time-setters in X5455_ExtendedTimestamp now set the corresponding flags explicitly - i.e. they set the bit if the valus is not-null and reset it otherwise. This may cause incompatibilities if you use setFlags to unset a bit and later set the time to a non-null value - the flag will now be set. - + GzipCompressorOutputStream now supports setting the compression level and the header metadata (filename, comment, modification time, operating system and extra flags) @@ -395,7 +398,7 @@ This also changes the superclass of ZCompressorInputStream. ZipFile and the 7z file classes now implement Closeable and can be used in try-with-resources constructs. - + @@ -527,7 +530,7 @@ This also changes the superclass of ZCompressorInputStream. ZipArchiveInputStream now reads archives that start with a "PK00" signature. Archives with this signatures are created when the archiver was willing to split the archive but in the - end only needed a single segment - so didn't split anything. + end only needed a single segment - so didn't split anything. TarArchiveEntry has a new constructor that allows setting @@ -626,43 +629,43 @@ This also changes the superclass of ZCompressorInputStream. eight bits of each character which effectively only worked for ASCII and ISO-8859-1 file names. This new default behavior is a breaking change. - + TarArchiveInputStream failed to parse PAX headers that contained non-ASCII characters. - + The tar package can now write archives that use star/GNU/BSD extensions or use the POSIX/PAX variant to store numeric values that don't fit into the traditional header fields. - + Added a workaround for a Bug some tar implementations that add a NUL byte as first byte in numeric header fields. - + Added a workaround for a Bug in WinZIP which uses backslashes as path separators in Unicode Extra Fields. - + ArrayOutOfBounds while decompressing bz2. Added test case - code already seems to have been fixed. - + TarArchiveInputStream throws IllegalArgumentException instead of IOException - + TarUtils.formatLongOctalOrBinaryBytes() assumes the field will be 12 bytes long - + GNU Tar sometimes uses binary encoding for UID and GID - + ArchiveStreamFactory.createArchiveInputStream would claim short text files were TAR archives. - + Support for the XZ format has been added. - + BZip2CompressorInputStream now optionally supports reading of concatenated .bz2 files. @@ -699,30 +702,30 @@ This also changes the superclass of ZCompressorInputStream. description="Release 1.3 - API compatible to 1.2 but requires Java5 at runtime"> Support for the Pack200 format has been added. - + Read-only support for the format used by the Unix dump(8) tool has been added. - + The ZIP package now supports Zip64 extensions. - + The AR package now supports the BSD dialect of storing file names longer than 16 chars (both reading and writing). - + BZip2CompressorInputStream's getBytesRead method always returned 0. - + ZipArchiveInputStream and ZipArchiveOutputStream could leak resources on some JDKs. - + TarArchiveOutputStream's getBytesWritten method didn't count correctly. - + @@ -749,41 +752,41 @@ This also changes the superclass of ZCompressorInputStream. due-to="Trejkaz"> ArArchiveInputStream fails if entries contain only blanks for userId or groupId. - + ZipFile may leak resources on some JDKs. - + ZipFile now implements finalize which closes the underlying file. Certain tar files not recognised by ArchiveStreamFactory. - + BZip2CompressorInputStream throws IOException if underlying stream returns available() == 0. Removed the check. - + Calling close() on inputStream returned by CompressorStreamFactory.createCompressorInputStream() does not close the underlying input stream. - + TarArchiveEntry provides access to the flags that determine whether it is an archived symbolic link, pipe or other "uncommon" file system object. - + TarArchiveOutputStream#finish now writes all buffered data to the stream - + Move acknowledgements from NOTICE to README - + TarArchiveEntry.parseTarHeader() includes the trailing space/NUL when parsing the octal size - + Command-line interface to list archive contents. Usage: java -jar commons-compress-n.m.jar archive-name [zip|tar|etc] http://git-wip-us.apache.org/repos/asf/commons-compress/blob/b67a1469/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java b/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java index 398783f..809a9dc 100644 --- a/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java +++ b/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java @@ -17,6 +17,7 @@ */ package org.apache.commons.compress.archivers.sevenz; +import java.io.BufferedInputStream; import java.io.ByteArrayInputStream; import java.io.Closeable; import java.io.DataInput; @@ -853,8 +854,10 @@ public class SevenZFile implements Closeable { private InputStream buildDecoderStack(final Folder folder, final long folderOffset, final int firstPackStreamIndex, SevenZArchiveEntry entry) throws IOException { file.seek(folderOffset); - InputStream inputStreamStack = new BoundedRandomAccessFileInputStream(file, - archive.packSizes[firstPackStreamIndex]); + InputStream inputStreamStack = + new BufferedInputStream( + new BoundedRandomAccessFileInputStream(file, + archive.packSizes[firstPackStreamIndex])); LinkedList methods = new LinkedList(); for (final Coder coder : folder.getOrderedCoders()) { if (coder.numInStreams != 1 || coder.numOutStreams != 1) {