Compressor cmp = codec.createCompressor();
dstPath = new Path(path + codec.getDefaultExtension());
hdfs = dstPath.getFileSystem(conf);
writer = hdfs.create(dstPath);
try {
writer = codec.createOutputStream(writer, cmp);
} catch (NullPointerException npe) {
// tries to find "native" version of codec, if that fails, then tries to
// find java version. If there is no java version, the createOutputStream
// exits via NPE. We capture this and convert it into a IOE with a more
// useful error message.