commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r1028793 - in /commons/proper/compress/trunk/src: changes/changes.xml main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java
Date Fri, 29 Oct 2010 15:03:49 GMT
Author: bodewig
Date: Fri Oct 29 15:03:49 2010
New Revision: 1028793

URL: http://svn.apache.org/viewvc?rev=1028793&view=rev
Log:
provide access to TarArchiveEntry's knowledge of the entry's type.  COMPRESS-122

Modified:
    commons/proper/compress/trunk/src/changes/changes.xml
    commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.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=1028793&r1=1028792&r2=1028793&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/changes/changes.xml (original)
+++ commons/proper/compress/trunk/src/changes/changes.xml Fri Oct 29 15:03:49 2010
@@ -45,6 +45,11 @@ The <action> type attribute can be add,u
   </properties>
   <body>
     <release version="1.2" date="as in SVN" description="Release 1.2">
+      <action issue="COMPRESS-122" type="add" date="2010-10-29">
+        TarArchiveEntry provides access to the flags that determine
+        whether it is an archived symbolic link, pipe or other
+        "uncommon" file system object.
+      </action> 
       <action issue="COMPRESS-119" type="fix" date="2010-10-26">
         TarArchiveOutputStream#finish now writes all buffered data to the stream
       </action> 

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=1028793&r1=1028792&r2=1028793&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
Fri Oct 29 15:03:49 2010
@@ -594,6 +594,66 @@ public class TarArchiveEntry implements 
     }
 
     /**
+     * Check if this is a "normal file"
+     *
+     * @since Apache Commons Compress 1.2
+     */
+    public boolean isFile() {
+        if (file != null) {
+            return file.isFile();
+        }
+        if (linkFlag == LF_OLDNORM || linkFlag == LF_NORMAL) {
+            return true;
+        }
+        return !getName().endsWith("/");
+    }
+
+    /**
+     * Check if this is a symbolic link entry.
+     *
+     * @since Apache Commons Compress 1.2
+     */
+    public boolean isSymbolicLink() {
+        return linkFlag == LF_SYMLINK;
+    }
+
+    /**
+     * Check if this is a link entry.
+     *
+     * @since Apache Commons Compress 1.2
+     */
+    public boolean isLink() {
+        return linkFlag == LF_LINK;
+    }
+
+    /**
+     * Check if this is a character device entry.
+     *
+     * @since Apache Commons Compress 1.2
+     */
+    public boolean isCharacterDevice() {
+        return linkFlag == LF_CHR;
+    }
+
+    /**
+     * Check if this is a block device entry.
+     *
+     * @since Apache Commons Compress 1.2
+     */
+    public boolean isBlockDevice() {
+        return linkFlag == LF_BLK;
+    }
+
+    /**
+     * Check if this is a FIFO (pipe) entry.
+     *
+     * @since Apache Commons Compress 1.2
+     */
+    public boolean isFIFO() {
+        return linkFlag == LF_FIFO;
+    }
+
+    /**
      * If this entry represents a file, and the file is a directory, return
      * an array of TarEntries for this entry's children.
      *



Mime
View raw message