You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by bo...@apache.org on 2012/03/10 07:45:36 UTC

svn commit: r1299151 - in /commons/proper/compress/trunk/src: changes/ main/java/org/apache/commons/compress/archivers/tar/ site/xdoc/ test/java/org/apache/commons/compress/archivers/tar/

Author: bodewig
Date: Sat Mar 10 06:45:36 2012
New Revision: 1299151

URL: http://svn.apache.org/viewvc?rev=1299151&view=rev
Log:
rename bigFileMode to bigNumberMode.  COMPRESS-182

Modified:
    commons/proper/compress/trunk/src/changes/changes.xml
    commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStream.java
    commons/proper/compress/trunk/src/site/xdoc/tar.xml
    commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStreamTest.java

Modified: commons/proper/compress/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/changes/changes.xml?rev=1299151&r1=1299150&r2=1299151&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/changes/changes.xml (original)
+++ commons/proper/compress/trunk/src/changes/changes.xml Sat Mar 10 06:45:36 2012
@@ -46,6 +46,11 @@ The <action> type attribute can be add,u
   <body>
     <release version="1.4" date="unreleased"
              description="Release 1.4">
+      <action issue="COMPRESS-182" type="update" date="2012-03-02">
+        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.
+      </action> 
       <action issue="COMPRESS-181" type="update" date="2012-03-02">
         Added a workaround for a Bug some tar implementations that add
         a NUL byte as first byte in numeric header fields.

Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStream.java?rev=1299151&r1=1299150&r2=1299151&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStream.java (original)
+++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStream.java Sat Mar 10 06:45:36 2012
@@ -48,14 +48,14 @@ public class TarArchiveOutputStream exte
     /** POSIX/PAX extensions are used to store long file names in the archive. */
     public static final int LONGFILE_POSIX = 3;
 
-    /** Fail if a big file (&gt; 8GiB) is required in the archive. */
-    public static final int BIGFILE_ERROR = 0;
+    /** Fail if a big number (e.g. size &gt; 8GiB) is required in the archive. */
+    public static final int BIGNUMBER_ERROR = 0;
 
-    /** star/GNU tar/BSD tar extensions are used to store big file sizes in the archive. */
-    public static final int BIGFILE_STAR = 1;
+    /** star/GNU tar/BSD tar extensions are used to store big number in the archive. */
+    public static final int BIGNUMBER_STAR = 1;
 
-    /** POSIX/PAX extensions are used to store big file sizes in the archive. */
-    public static final int BIGFILE_POSIX = 2;
+    /** POSIX/PAX extensions are used to store big numbers in the archive. */
+    public static final int BIGNUMBER_POSIX = 2;
 
     private long      currSize;
     private String    currName;
@@ -65,7 +65,7 @@ public class TarArchiveOutputStream exte
     private final byte[]    assemBuf;
     protected final TarBuffer buffer;
     private int       longFileMode = LONGFILE_ERROR;
-    private int       bigFileMode = BIGFILE_ERROR;
+    private int       bigNumberMode = BIGNUMBER_ERROR;
 
     private boolean closed = false;
 
@@ -121,15 +121,15 @@ public class TarArchiveOutputStream exte
     }
 
     /**
-     * Set the big file mode.
-     * This can be BIGFILE_ERROR(0), BIGFILE_POSIX(1) or BIGFILE_STAR(2).
-     * This specifies the treatment of big files (sizes &gt; TarConstants.MAXSIZE).
-     * Default is BIGFILE_ERROR.
-     * @param bigFileMode the mode to use
+     * Set the big number mode.
+     * This can be BIGNUMBER_ERROR(0), BIGNUMBER_POSIX(1) or BIGNUMBER_STAR(2).
+     * This specifies the treatment of big files (sizes &gt; TarConstants.MAXSIZE) and other numeric values to big to fit into a traditional tar header.
+     * Default is BIGNUMBER_ERROR.
+     * @param bigNumberMode the mode to use
      * @since Apache Commons Compress 1.4
      */
-    public void setBigFileMode(int bigFileMode) {
-        this.bigFileMode = bigFileMode;
+    public void setBigNumberMode(int bigNumberMode) {
+        this.bigNumberMode = bigNumberMode;
     }
 
 
@@ -237,9 +237,9 @@ public class TarArchiveOutputStream exte
             }
         }
 
-        if (bigFileMode == BIGFILE_POSIX) {
+        if (bigNumberMode == BIGNUMBER_POSIX) {
             addPaxHeadersForBigNumbers(paxHeaders, entry);
-        } else if (bigFileMode != BIGFILE_STAR) {
+        } else if (bigNumberMode != BIGNUMBER_STAR) {
             failForBigNumbers(entry);
         }
 
@@ -247,7 +247,7 @@ public class TarArchiveOutputStream exte
             writePaxHeaders(entry.getName(), paxHeaders);
         }
 
-        entry.writeEntryHeader(recordBuf, bigFileMode == BIGFILE_STAR);
+        entry.writeEntryHeader(recordBuf, bigNumberMode == BIGNUMBER_STAR);
         buffer.writeRecord(recordBuf);
 
         currBytes = 0;
@@ -458,7 +458,7 @@ public class TarArchiveOutputStream exte
                                  TarConstants.MAXSIZE);
         addPaxHeaderForBigNumber(paxHeaders, "uid", entry.getUserId(),
                                  TarConstants.MAXID);
-        // star extensions by J\u00f6rg Schillig
+        // star extensions by J\u00f6rg Schilling
         addPaxHeaderForBigNumber(paxHeaders, "SCHILY.devmajor",
                                  entry.getDevMajor(), TarConstants.MAXID);
         addPaxHeaderForBigNumber(paxHeaders, "SCHILY.devminor",

Modified: commons/proper/compress/trunk/src/site/xdoc/tar.xml
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/site/xdoc/tar.xml?rev=1299151&r1=1299150&r2=1299151&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/site/xdoc/tar.xml (original)
+++ commons/proper/compress/trunk/src/site/xdoc/tar.xml Sat Mar 10 06:45:36 2012
@@ -71,21 +71,23 @@
         transparently.</p>
       </subsection>
 
-      <subsection name="Big Entries">
+      <subsection name="Big Numeric Values">
 
-        <p>The <code>bigFileMode</code> option of
+        <p>The <code>bigNumberMode</code> option of
         <code>TarArchiveOutputStream</code> controls how files larger
-        than 8GiB are handled.  The possible choices are:</p>
+        than 8GiB or with other big numeric values that can't be
+        encoded in traditional header fields are handled.  The
+        possible choices are:</p>
 
         <ul>
-          <li><code>BIGFILE_ERROR</code>: throw an exception if such a
-          file is added.  This is the default.</li>
-          <li><code>BIGFILE_STAR</code>: use a variant first
+          <li><code>BIGNUMBER_ERROR</code>: throw an exception if such an
+          entry is added.  This is the default.</li>
+          <li><code>BIGNUMBER_STAR</code>: use a variant first
           introduced by J&#xf6;rg Schilling's <a
           href="http://developer.berlios.de/projects/star">star</a>
           and later adopted by GNU and BSD tar.  This method is not
           supported by all implementations.</li>
-          <li><code>BIGFILE_POSIX</code>: use a PAX <a
+          <li><code>BIGNUMBER_POSIX</code>: use a PAX <a
           href="http://pubs.opengroup.org/onlinepubs/009695399/utilities/pax.html#tag_04_100_13_03">extended
           header</a> as defined by POSIX 1003.1.  Most modern tar
           implementations are able to extract such archives.</li>
@@ -93,8 +95,8 @@
 
         <p>Starting with Commons Compress 1.4
         <code>TarArchiveInputStream</code> will recognize the star as
-        well as the POSIX extensions for big file sizes and reads the
-        sizes transparently.</p>
+        well as the POSIX extensions for big numeric values and reads them
+        transparently.</p>
       </subsection>
 
       <subsection name="Sparse files">

Modified: commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStreamTest.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStreamTest.java?rev=1299151&r1=1299150&r2=1299151&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStreamTest.java (original)
+++ commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStreamTest.java Sat Mar 10 06:45:36 2012
@@ -76,12 +76,12 @@ public class TarArchiveOutputStreamTest 
         }
     }
 
-    public void testBigFileStarMode() throws Exception {
+    public void testBigNumberStarMode() throws Exception {
         TarArchiveEntry t = new TarArchiveEntry("foo");
         t.setSize(0100000000000L);
         ByteArrayOutputStream bos = new ByteArrayOutputStream();
         TarArchiveOutputStream tos = new TarArchiveOutputStream(bos);
-        tos.setBigFileMode(TarArchiveOutputStream.BIGFILE_STAR);
+        tos.setBigNumberMode(TarArchiveOutputStream.BIGNUMBER_STAR);
         tos.putArchiveEntry(t);
         // make sure header is written to byte array
         tos.write(new byte[10 * 1024]);
@@ -98,12 +98,12 @@ public class TarArchiveOutputStreamTest 
         assertEquals(0100000000000L, e.getSize());
     }
 
-    public void testBigFilePosixMode() throws Exception {
+    public void testBigNumberPosixMode() throws Exception {
         TarArchiveEntry t = new TarArchiveEntry("foo");
         t.setSize(0100000000000L);
         ByteArrayOutputStream bos = new ByteArrayOutputStream();
         TarArchiveOutputStream tos = new TarArchiveOutputStream(bos);
-        tos.setBigFileMode(TarArchiveOutputStream.BIGFILE_POSIX);
+        tos.setBigNumberMode(TarArchiveOutputStream.BIGNUMBER_POSIX);
         tos.putArchiveEntry(t);
         // make sure header is written to byte array
         tos.write(new byte[10 * 1024]);
@@ -213,7 +213,7 @@ public class TarArchiveOutputStreamTest 
         t.setModTime(-1000);
         ByteArrayOutputStream bos = new ByteArrayOutputStream();
         TarArchiveOutputStream tos = new TarArchiveOutputStream(bos);
-        tos.setBigFileMode(TarArchiveOutputStream.BIGFILE_STAR);
+        tos.setBigNumberMode(TarArchiveOutputStream.BIGNUMBER_STAR);
         tos.putArchiveEntry(t);
         // make sure header is written to byte array
         tos.write(new byte[10 * 1024]);
@@ -239,7 +239,7 @@ public class TarArchiveOutputStreamTest 
         t.setModTime(-1000);
         ByteArrayOutputStream bos = new ByteArrayOutputStream();
         TarArchiveOutputStream tos = new TarArchiveOutputStream(bos);
-        tos.setBigFileMode(TarArchiveOutputStream.BIGFILE_POSIX);
+        tos.setBigNumberMode(TarArchiveOutputStream.BIGNUMBER_POSIX);
         tos.putArchiveEntry(t);
         // make sure header is written to byte array
         tos.write(new byte[10 * 1024]);