code: public static void setDeflateLevel(Job job, int level) {
      FileOutputFormat.setCompressOutput(job, true);
      job.getConfiguration().setInt(DEFLATE_LEVEL_KEY, level);
    }
docs: Enable output compression using the deflate codec and specify its level.