hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cdoug...@apache.org
Subject svn commit: r946976 - in /hadoop/common/trunk: CHANGES.txt src/java/org/apache/hadoop/fs/FsShell.java
Date Fri, 21 May 2010 11:45:12 GMT
Author: cdouglas
Date: Fri May 21 11:45:12 2010
New Revision: 946976

URL: http://svn.apache.org/viewvc?rev=946976&view=rev
Log:
HADOOP-6714. Resolve compressed files using CodecFactory in FsShell::text. Contributed by
Patrick Angeles

Modified:
    hadoop/common/trunk/CHANGES.txt
    hadoop/common/trunk/src/java/org/apache/hadoop/fs/FsShell.java

Modified: hadoop/common/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/CHANGES.txt?rev=946976&r1=946975&r2=946976&view=diff
==============================================================================
--- hadoop/common/trunk/CHANGES.txt (original)
+++ hadoop/common/trunk/CHANGES.txt Fri May 21 11:45:12 2010
@@ -21,6 +21,9 @@ Trunk (unreleased changes)
     HADOOP-6761. The Trash Emptier has the ability to run more frequently.
     (Dmytro Molkov via dhruba)
 
+    HADOOP-6714. Resolve compressed files using CodecFactory in FsShell::text.
+    (Patrick Angeles via cdouglas)
+
   BUG FIXES
 
     HADOOP-6781. security audit log shouldn't have exception in it.

Modified: hadoop/common/trunk/src/java/org/apache/hadoop/fs/FsShell.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/src/java/org/apache/hadoop/fs/FsShell.java?rev=946976&r1=946975&r2=946976&view=diff
==============================================================================
--- hadoop/common/trunk/src/java/org/apache/hadoop/fs/FsShell.java (original)
+++ hadoop/common/trunk/src/java/org/apache/hadoop/fs/FsShell.java Fri May 21 11:45:12 2010
@@ -36,6 +36,8 @@ import org.apache.hadoop.io.IOUtils;
 import org.apache.hadoop.io.SequenceFile;
 import org.apache.hadoop.io.Writable;
 import org.apache.hadoop.io.WritableComparable;
+import org.apache.hadoop.io.compress.CompressionCodec;
+import org.apache.hadoop.io.compress.CompressionCodecFactory;
 import org.apache.hadoop.ipc.RPC;
 import org.apache.hadoop.ipc.RemoteException;
 import org.apache.hadoop.util.ReflectionUtils;
@@ -402,6 +404,14 @@ public class FsShell extends Configured 
 
   private InputStream forMagic(Path p, FileSystem srcFs) throws IOException {
     FSDataInputStream i = srcFs.open(p);
+
+    // check codecs
+    CompressionCodecFactory cf = new CompressionCodecFactory(getConf());
+    CompressionCodec codec = cf.getCodec(p);
+    if (codec != null) {
+      return codec.createInputStream(i);
+    }
+
     switch(i.readShort()) {
       case 0x1f8b: // RFC 1952
         i.seek(0);



Mime
View raw message