Package org.apache.hadoop.io.compress

Examples of org.apache.hadoop.io.compress.CompressionCodecFactory


    Compressor compressor;

    FileSystem fs = resultPath.getFileSystem(conf);
    CompressionCodec codec =
        new CompressionCodecFactory(conf).getCodec(resultPath);
    OutputStream output;
    if (codec != null) {
      compressor = CodecPool.getCompressor(codec);
      output = codec.createOutputStream(fs.create(resultPath), compressor);
    } else {
View Full Code Here


        boolean isCompressed = in.readBoolean();
        v.visit(ImageElement.IS_COMPRESSED, String.valueOf(isCompressed));
        if (isCompressed) {
          String codecClassName = Text.readString(in);
          v.visit(ImageElement.COMPRESS_CODEC, codecClassName);
          CompressionCodecFactory codecFac = new CompressionCodecFactory(
              new Configuration());
          CompressionCodec codec = codecFac.getCodecByClassName(codecClassName);
          if (codec == null) {
            throw new IOException("Image compression codec not supported: "
                + codecClassName);
          }
          in = new DataInputStream(codec.createInputStream(in));
View Full Code Here

  }
 
  @Override
  protected boolean isSplitable(JobContext context, Path file) {
    final CompressionCodec codec =
      new CompressionCodecFactory(context.getConfiguration()).getCodec(file);
    if (null == codec) {
      return true;
    }
    return codec instanceof SplittableCompressionCodec;
  }
View Full Code Here

    // local FS must be raw in order to be Syncable
    conf.set("fs.file.impl", "org.apache.hadoop.fs.RawLocalFileSystem");
    Path path = new Path(fileURI);
    path.getFileSystem(conf); // get FS with our conf cached

    this.factory = new CompressionCodecFactory(conf);
  }
View Full Code Here

      throw new FileNotFoundException(path.toString());
    }

    String codecName = this.meta.getOption(StorageConstants.COMPRESSION_CODEC);
    if(!StringUtils.isEmpty(codecName)){
      codecFactory = new CompressionCodecFactory(conf);
      codec = codecFactory.getCodecByClassName(codecName);
    } else {
      if (fs.exists(path)) {
        throw new AlreadyExistsStorageException(path);
      }
View Full Code Here

    Configuration conf = new Configuration();
    // local FS must be raw in order to be Syncable
    conf.set("fs.file.impl", "org.apache.hadoop.fs.RawLocalFileSystem");
    Path path = new Path(fileURI);
    FileSystem fs = path.getFileSystem(conf); // get FS with our conf cached
    CompressionCodecFactory factory = new CompressionCodecFactory(conf);

    HDFSCompressedDataStream writer = new HDFSCompressedDataStream();
    FlumeFormatter fmt = new HDFSTextFormatter();
    writer.open(fileURI, factory.getCodec(new Path(fileURI)),
        SequenceFile.CompressionType.BLOCK, fmt);
    String body = "yarf!";
    Event evt = EventBuilder.withBody(body, Charsets.UTF_8);
    writer.append(evt, fmt);
    writer.sync();
View Full Code Here

      this.maxLineLength = job.getInt("bsp.linerecordreader.maxlength",
          Integer.MAX_VALUE);
      start = split.getStart();
      end = start + split.getLength();
      final Path file = split.getPath();
      compressionCodecs = new CompressionCodecFactory(job);
      final CompressionCodec codec = compressionCodecs.getCodec(file);

      // open the file and seek to the start of the split
      FileSystem fs = file.getFileSystem(job);
      FSDataInputStream fileIn = fs.open(split.getPath());
View Full Code Here

    Compressor compressor;

    FileSystem fs = resultPath.getFileSystem(conf);
    CompressionCodec codec =
        new CompressionCodecFactory(conf).getCodec(resultPath);
    OutputStream output;
    if (codec != null) {
      compressor = CodecPool.getCompressor(codec);
      output = codec.createOutputStream(fs.create(resultPath), compressor);
    } else {
View Full Code Here

    Configuration job = context.getConfiguration();
    this.maxLineLength = job.getInt(MAX_LINE_LENGTH, Integer.MAX_VALUE);
    start = split.getStart();
    end = start + split.getLength();
    final Path file = split.getPath();
    compressionCodecs = new CompressionCodecFactory(job);
    codec = compressionCodecs.getCodec(file);

    // open the file and seek to the start of the split
    final FileSystem fs = file.getFileSystem(job);
    fileIn = fs.open(file);
View Full Code Here

  implements JobConfigurable {

  private CompressionCodecFactory compressionCodecs = null;
 
  public void configure(JobConf conf) {
    compressionCodecs = new CompressionCodecFactory(conf);
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.io.compress.CompressionCodecFactory

Copyright © 2018 www.massapicom. 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.