Source:
<code>public static void main(String[] args) throws Exception { Configuration conf = CachedConfiguration.getInstance(); FileSystem fs = FileSystem.get(conf); Opts opts = new Opts(); opts.parseArgs(SplitLarge.class.getName(), args); for (String file : opts.files) { AccumuloConfiguration aconf = DefaultConfiguration.getInstance(); <START> CryptoService cryptoService = CryptoServiceFactory.newInstance(aconf); <END> Path path = new Path(file); CachableBlockFile.Reader rdr = new CachableBlockFile.Reader(fs, path, conf, null, null, aconf, cryptoService); try (Reader iter = new RFile.Reader(rdr)) { if (!file.endsWith(".rf")) { throw new IllegalArgumentException("File must end with .rf"); } String smallName = file.substring(0, file.length() - 3) + "_small.rf"; String largeName = file.substring(0, file.length() - 3) + "_large.rf"; int blockSize = (int) aconf.getAsBytes(Property.TABLE_FILE_BLOCK_SIZE); try ( Writer small = new RFile.Writer(new BCFile.Writer(fs.create(new Path(smallName)), null, "gz", conf, aconf, cryptoService), blockSize); Writer large = new RFile.Writer(new BCFile.Writer(fs.create(new Path(largeName)), null, "gz", conf, aconf, cryptoService), blockSize)) { small.startDefaultLocalityGroup(); large.startDefaultLocalityGroup(); iter.seek(new Range(), new ArrayList<>(), false); while (iter.hasTop()) { Key key = iter.getTopKey(); Value value = iter.getTopValue(); if (key.getSize() + value.getSize() < opts.maxSize) { small.append(key, value); } else { large.append(key, value); } iter.next(); } } } } }</code><technical_language>aconf is default configuration</technical_language>

Target:
public static void main(String[] args) throws Exception { Configuration conf = CachedConfiguration.getInstance(); FileSystem fs = FileSystem.get(conf); Opts opts = new Opts(); opts.parseArgs(SplitLarge.class.getName(), args); for (String file : opts.files) { AccumuloConfiguration aconf = DefaultConfiguration.getInstance(); CryptoService cryptoService = ConfigurationTypeHelper.getClassInstance(null, opts.cryptoClass, CryptoService.class, new NoCryptoService()); Path path = new Path(file); CachableBlockFile.Reader rdr = new CachableBlockFile.Reader(fs, path, conf, null, null, aconf, cryptoService); try (Reader iter = new RFile.Reader(rdr)) { if (!file.endsWith(".rf")) { throw new IllegalArgumentException("File must end with .rf"); } String smallName = file.substring(0, file.length() - 3) + "_small.rf"; String largeName = file.substring(0, file.length() - 3) + "_large.rf"; int blockSize = (int) aconf.getAsBytes(Property.TABLE_FILE_BLOCK_SIZE); try ( Writer small = new RFile.Writer(new BCFile.Writer(fs.create(new Path(smallName)), null, "gz", conf, aconf, cryptoService), blockSize); Writer large = new RFile.Writer(new BCFile.Writer(fs.create(new Path(largeName)), null, "gz", conf, aconf, cryptoService), blockSize)) { small.startDefaultLocalityGroup(); large.startDefaultLocalityGroup(); iter.seek(new Range(), new ArrayList<>(), false); while (iter.hasTop()) { Key key = iter.getTopKey(); Value value = iter.getTopValue(); if (key.getSize() + value.getSize() < opts.maxSize) { small.append(key, value); } else { large.append(key, value); } iter.next(); } } } } }