Examples of LzopCodec


Examples of com.hadoop.compression.lzo.LzopCodec

    Configuration config = new Configuration();
    FileSystem hdfs = FileSystem.get(config);

    Path destFile = new Path(args[0]);

    LzopCodec codec = new LzopCodec();
    codec.setConf(config);
    InputStream is = codec.createInputStream(hdfs.open(destFile));

    readFromProtoBuf(is);
  }
View Full Code Here

Examples of com.hadoop.compression.lzo.LzopCodec

      }else if (fileType.equalsIgnoreCase("gz") || fileType.equalsIgnoreCase("gzip")){
        gin = new GZIPInputStream(in);
              br = new BufferedReader(
                      new InputStreamReader(gin, encoding), bufferSize);
      }else if (fileType.equalsIgnoreCase("lzo")){
        LzopCodec lzopCodec = new LzopCodec();
        lzopCodec.setConf(SFTPUtils.getConf());
       
        cin = lzopCodec.createInputStream(in);
              br = new BufferedReader(new InputStreamReader(cin, encoding), bufferSize);
      }else{
        throw new IllegalArgumentException("illegal argument fileType=" + fileType);
      }
    } catch (Exception e){
View Full Code Here

Examples of com.hadoop.compression.lzo.LzopCodec

          || fileType.equalsIgnoreCase("gzip")) {
        gout = new GZIPOutputStream(out);
        bw = new BufferedWriter(new OutputStreamWriter(gout, encoding),
            bufferSize);
      } else if (fileType.equalsIgnoreCase("lzo")) {
        LzopCodec lzopCodec = new LzopCodec();
        lzopCodec.setConf(SFTPUtils.getConf());

        cout = lzopCodec.createOutputStream(out);
        bw = new BufferedWriter(new OutputStreamWriter(cout, encoding),
            bufferSize);
      } else {
        throw new IllegalArgumentException("illegal argument fileType="
            + fileType);
View Full Code Here

Examples of com.hadoop.compression.lzo.LzopCodec

        LzoRecordReader.BAD_RECORD_MIN_COUNT_CONF_KEY, ""+(totalErrors+1));
    verifyRows(expectedRows, pigServer.openIterator("A"));
  }

  private DataOutputStream createLzoOut(File file, Configuration conf) throws IOException {
    LzopCodec codec = new LzopCodec();
    codec.setConf(conf);

    if (file.exists()) {
      file.delete();
    }
    return new DataOutputStream(codec.createOutputStream(new FileOutputStream(file)));
  }
View Full Code Here

Examples of com.hadoop.compression.lzo.LzopCodec

    FileUtil.fullyDelete(inputDir);
  }

  private DataOutputStream createLzoOut(String name, Configuration conf) throws IOException {
    File file = new File(inputDir, name);
    LzopCodec codec = new LzopCodec();
    codec.setConf(conf);

    if (file.exists()) {
      file.delete();
    }
    return new DataOutputStream(codec.createOutputStream(new FileOutputStream(file)));
  }
View Full Code Here

Examples of com.hadoop.compression.lzo.LzopCodec

    FileUtil.fullyDelete(inputDir);
  }

  private DataOutputStream createLzoOut(String name, Configuration conf) throws IOException {
    File file = new File(inputDir, name);
    LzopCodec codec = new LzopCodec();
    codec.setConf(conf);

    if (file.exists()) {
      file.delete();
    }
    return new DataOutputStream(codec.createOutputStream(new FileOutputStream(file)));
  }
View Full Code Here

Examples of com.hadoop.compression.lzo.LzopCodec

   * the index file is deleted (in line with {@link LzoIndexer} behavior).
   */
  public static DataOutputStream
  getIndexedLzoOutputStream(Configuration conf, Path path) throws IOException {

    LzopCodec codec = new LzopCodec();
    codec.setConf(conf);

    final Path file = path;
    final FileSystem fs = file.getFileSystem(conf);
    FSDataOutputStream fileOut = fs.create(file, false);

    FSDataOutputStream indexOut = null;
    if (conf.getBoolean("elephantbird.lzo.output.index", false)) {
      if ( isLzopIndexSupported ) {
        Path indexPath = file.suffix(LzoIndex.LZO_TMP_INDEX_SUFFIX);
        indexOut = fs.create(indexPath, false);
      } else {
        LOG.warn("elephantbird.lzo.output.index is enabled, but LzopCodec "
            + "does not have createIndexedOutputStream method. "
            + "Please upgrade hadoop-lzo.");
      }
    }

    final boolean isIndexed = indexOut != null;

    OutputStream out = ( isIndexed ?
        codec.createIndexedOutputStream(fileOut, indexOut) :
        codec.createOutputStream(fileOut) );

    return new DataOutputStream(out) {
      // override close() to handle renaming index file.

      public void close() throws IOException {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.