commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r761320 - in /commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar: TarArchiveEntry.java TarConstants.java
Date Thu, 02 Apr 2009 15:19:18 GMT
Author: sebb
Date: Thu Apr  2 15:19:17 2009
New Revision: 761320

URL: http://svn.apache.org/viewvc?rev=761320&view=rev
Log:
Update Javadoc
Rationalise MAGIC names

Modified:
    commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java
    commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarConstants.java

Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java?rev=761320&r1=761319&r2=761320&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java
(original)
+++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java
Thu Apr  2 15:19:17 2009
@@ -54,21 +54,27 @@
  * The C structure for a Tar Entry's header is:
  * <pre>
  * struct header {
- * char name[NAMSIZ];
- * char mode[8];
- * char uid[8];
- * char gid[8];
- * char size[12];
- * char mtime[12];
- * char chksum[8];
- * char linkflag;
- * char linkname[NAMSIZ];
- * char magic[8];
- * char uname[TUNMLEN];
- * char gname[TGNMLEN];
- * char devmajor[8];
- * char devminor[8];
+ * char name[100];     // TarConstants.NAMELEN
+ * char mode[8];       // TarConstants.MODELEN
+ * char uid[8];        // TarConstants.UIDLEN
+ * char gid[8];        // TarConstants.GIDLEN
+ * char size[12];      // TarConstants.SIZELEN
+ * char mtime[12];     // TarConstants.MODTIMELEN
+ * char chksum[8];     // TarConstants.CHKSUMLEN
+ * char linkflag[1];
+ * char linkname[100]; // TarConstants.NAMELEN
+ * The following fields are only present in new-style POSIX tar archives:
+ * char magic[8];      // TarConstants.MAGICLEN
+ * TODO: Posix/GNU split this into magic[6] and char version[2];
+ * char uname[32];     // TarConstants.UNAMELEN
+ * char gname[32];     // TarConstants.GNAMELEN
+ * char devmajor[8];   // TarConstants.DEVLEN
+ * char devminor[8];   // TarConstants.DEVLEN
+ * char prefix[155];   // Used if "name" field is not long enough to hold the path
+ * char pad[12];       // NULs
  * } header;
+ * All unused bytes are set to null.
+ * New-style GNU tar files are slightly different from the above.
  * </pre>
  * 
  * @NotThreadSafe
@@ -133,7 +139,7 @@
      * Construct an empty entry and prepares the header values.
      */
     private TarArchiveEntry () {
-        this.magic = new StringBuffer(TMAGIC);
+        this.magic = new StringBuffer(MAGIC_POSIX);
         this.name = new StringBuffer();
         this.linkName = new StringBuffer();
 

Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarConstants.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarConstants.java?rev=761320&r1=761319&r2=761320&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarConstants.java
(original)
+++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarConstants.java
Thu Apr  2 15:19:17 2009
@@ -63,7 +63,7 @@
     /**
      * The length of the magic field in a header buffer.
      */
-    int    MAGICLEN = 8;
+    int    MAGICLEN = 8; // TODO split this into MAGICLEN=6 and VERSIONLEN=2
 
     /**
      * The length of the modification time field in a header buffer.
@@ -81,7 +81,7 @@
     int    GNAMELEN = 32;
 
     /**
-     * The length of the devices field in a header buffer.
+     * The length of each of the device fields (major and minor) in a header buffer.
      */
     int    DEVLEN = 8;
 
@@ -134,17 +134,17 @@
     /**
      * The magic tag representing a POSIX tar archive.
      */
-    String TMAGIC = "ustar";
+    String MAGIC_POSIX = "ustar"; // TODO this should be NUL-terminated
 
     /**
      * The magic tag representing a GNU tar archive.
      */
-    String GNU_TMAGIC = "ustar  ";
+    String MAGIC_GNU = "ustar  "; // TODO this should have single space terminator
 
     /**
-     * The namr of the GNU tar entry which contains a long name.
+     * The name of the GNU tar entry which contains a long name.
      */
-    String GNU_LONGLINK = "././@LongLink";
+    String GNU_LONGLINK = "././@LongLink"; // TODO rename as LONGLINK_GNU ?
 
     /**
      * Identifies the *next* file on the tape as having a long name.



Mime
View raw message