Author: bodewig Date: Tue Jun 11 16:20:23 2013 New Revision: 1491861 URL: http://svn.apache.org/r1491861 Log: merge 7z write support
Added: commons/proper/compress/branches/LZMA/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZOutputFile.java - copied unchanged from r1491496, commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZOutputFile.java commons/proper/compress/branches/LZMA/src/test/java/org/apache/commons/compress/archivers/SevenZTestCase.java - copied unchanged from r1491496, commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/SevenZTestCase.java Modified: commons/proper/compress/branches/LZMA/ (props changed) commons/proper/compress/branches/LZMA/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java commons/proper/compress/branches/LZMA/src/main/java/org/apache/commons/compress/archivers/sevenz/package.html commons/proper/compress/branches/LZMA/src/site/xdoc/examples.xml commons/proper/compress/branches/LZMA/src/site/xdoc/index.xml Propchange: commons/proper/compress/branches/LZMA/ ------------------------------------------------------------------------------ Merged /commons/proper/compress/trunk:r1491496 Modified: commons/proper/compress/branches/LZMA/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java URL: http://svn.apache.org/viewvc/commons/proper/compress/branches/LZMA/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java?rev=1491861&r1=1491860&r2=1491861&view=diff ============================================================================== --- commons/proper/compress/branches/LZMA/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java (original) +++ commons/proper/compress/branches/LZMA/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java Tue Jun 11 16:20:23 2013 @@ -69,7 +69,7 @@ import org.apache.commons.compress.utils */ public class SevenZFile { private static final boolean DEBUG = false; - private static final int SIGNATURE_HEADER_SIZE = 32; + static final int SIGNATURE_HEADER_SIZE = 32; private RandomAccessFile file; private final Archive archive; private int currentEntryIndex = -1; @@ -78,7 +78,7 @@ public class SevenZFile { private InputStream currentEntryInputStream = null; private String password; - private static final byte[] sevenZSignature = { + static final byte[] sevenZSignature = { (byte)'7', (byte)'z', (byte)0xBC, (byte)0xAF, (byte)0x27, (byte)0x1C }; Modified: commons/proper/compress/branches/LZMA/src/main/java/org/apache/commons/compress/archivers/sevenz/package.html URL: http://svn.apache.org/viewvc/commons/proper/compress/branches/LZMA/src/main/java/org/apache/commons/compress/archivers/sevenz/package.html?rev=1491861&r1=1491860&r2=1491861&view=diff ============================================================================== --- commons/proper/compress/branches/LZMA/src/main/java/org/apache/commons/compress/archivers/sevenz/package.html (original) +++ commons/proper/compress/branches/LZMA/src/main/java/org/apache/commons/compress/archivers/sevenz/package.html Tue Jun 11 16:20:23 2013 @@ -18,7 +18,7 @@ --> <body> - <p>Provides classes for reading archives using + <p>Provides classes for reading and writing archives using the 7z format.</p> </body> </html> Modified: commons/proper/compress/branches/LZMA/src/site/xdoc/examples.xml URL: http://svn.apache.org/viewvc/commons/proper/compress/branches/LZMA/src/site/xdoc/examples.xml?rev=1491861&r1=1491860&r2=1491861&view=diff ============================================================================== --- commons/proper/compress/branches/LZMA/src/site/xdoc/examples.xml (original) +++ commons/proper/compress/branches/LZMA/src/site/xdoc/examples.xml Tue Jun 11 16:20:23 2013 @@ -462,6 +462,15 @@ lzmaIn.close(); LZMA2 and no header compression at all. Only AES-256/SHA-256 are supported for encryption.</p> + <p>Adding an entry to a 7z archive:</p> +<source><![CDATA[ +SevenZOutputFile sevenZOutput = new SevenZOutputFile(file); +SevenZArchiveEntry entry = sevenZOutput.createArchiveEntry(fileToArchive, name); +sevenZOutput.putArchiveEntry(entry); +sevenZOutput.write(contentOfEntry); +sevenZOutput.closeArchiveEntry(); +]]></source> + <p>Uncompressing a given 7z archive (you would certainly add exception handling and make sure all streams get closed properly):</p> Modified: commons/proper/compress/branches/LZMA/src/site/xdoc/index.xml URL: http://svn.apache.org/viewvc/commons/proper/compress/branches/LZMA/src/site/xdoc/index.xml?rev=1491861&r1=1491860&r2=1491861&view=diff ============================================================================== --- commons/proper/compress/branches/LZMA/src/site/xdoc/index.xml (original) +++ commons/proper/compress/branches/LZMA/src/site/xdoc/index.xml Tue Jun 11 16:20:23 2013 @@ -77,7 +77,7 @@ archivers where the <a href="zip.html">zip</a> implementation provides capabilities that go beyond the features found in java.util.zip. As of Commons Compress - 1.6 support for the dump, 7z and arj formats is + 1.6 support for the dump and arj formats is read-only.</p> <p>The compress component provides abstract base classes for