List of usage examples for org.apache.hadoop.util Options getOption
@SuppressWarnings("unchecked") public static <base, T extends base> T getOption(Class<T> cls, base[] opts) throws IOException
From source file:com.uber.hoodie.common.file.HoodieAppendLog.java
License:Apache License
/** * Create a new Writer with the given options. * @param conf the configuration to use//from w w w . jav a 2 s .c o m * @param opts the options to create the file with * @return a new Writer * @throws IOException */ public static Writer createWriter(Configuration conf, Writer.Option... opts) throws IOException { Writer.CompressionOption compressionOption = Options.getOption(Writer.CompressionOption.class, opts); CompressionType kind; if (compressionOption != null) { kind = compressionOption.getValue(); } else { kind = getDefaultCompressionType(conf); opts = Options.prependOptions(opts, Writer.compression(kind)); } switch (kind) { default: case NONE: return new Writer(conf, opts); case RECORD: return new RecordCompressWriter(conf, opts); case BLOCK: return new BlockCompressWriter(conf, opts); } }