HADOOP-6714. Resolve compressed files using CodecFactory in FsShell::text. Contributed by Patrick Angeles
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@946976 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f4998a7813
commit
af3fef3463
|
@ -21,6 +21,9 @@ Trunk (unreleased changes)
|
||||||
HADOOP-6761. The Trash Emptier has the ability to run more frequently.
|
HADOOP-6761. The Trash Emptier has the ability to run more frequently.
|
||||||
(Dmytro Molkov via dhruba)
|
(Dmytro Molkov via dhruba)
|
||||||
|
|
||||||
|
HADOOP-6714. Resolve compressed files using CodecFactory in FsShell::text.
|
||||||
|
(Patrick Angeles via cdouglas)
|
||||||
|
|
||||||
BUG FIXES
|
BUG FIXES
|
||||||
|
|
||||||
HADOOP-6781. security audit log shouldn't have exception in it.
|
HADOOP-6781. security audit log shouldn't have exception in it.
|
||||||
|
|
|
@ -36,6 +36,8 @@ import org.apache.hadoop.io.IOUtils;
|
||||||
import org.apache.hadoop.io.SequenceFile;
|
import org.apache.hadoop.io.SequenceFile;
|
||||||
import org.apache.hadoop.io.Writable;
|
import org.apache.hadoop.io.Writable;
|
||||||
import org.apache.hadoop.io.WritableComparable;
|
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.RPC;
|
||||||
import org.apache.hadoop.ipc.RemoteException;
|
import org.apache.hadoop.ipc.RemoteException;
|
||||||
import org.apache.hadoop.util.ReflectionUtils;
|
import org.apache.hadoop.util.ReflectionUtils;
|
||||||
|
@ -402,6 +404,14 @@ public class FsShell extends Configured implements Tool {
|
||||||
|
|
||||||
private InputStream forMagic(Path p, FileSystem srcFs) throws IOException {
|
private InputStream forMagic(Path p, FileSystem srcFs) throws IOException {
|
||||||
FSDataInputStream i = srcFs.open(p);
|
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()) {
|
switch(i.readShort()) {
|
||||||
case 0x1f8b: // RFC 1952
|
case 0x1f8b: // RFC 1952
|
||||||
i.seek(0);
|
i.seek(0);
|
||||||
|
|
Loading…
Reference in New Issue