Update Javadoc
Rationalise MAGIC names
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/compress/trunk@761320 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java b/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java
index 7b21896..91283a8 100644
--- a/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java
+++ b/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java
@@ -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();
diff --git a/src/main/java/org/apache/commons/compress/archivers/tar/TarConstants.java b/src/main/java/org/apache/commons/compress/archivers/tar/TarConstants.java
index 420dced..00aebe7 100644
--- a/src/main/java/org/apache/commons/compress/archivers/tar/TarConstants.java
+++ b/src/main/java/org/apache/commons/compress/archivers/tar/TarConstants.java
@@ -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.