private static CSVReader openCsv(File file) throws IOException { final Reader fileReader; if (file.getName().endsWith(".gz")) { final GZIPInputStream inputStream = new GZIPInputStream(new FileInputStream(file)); fileReader = new InputStreamReader(inputStream); } else { fileReader = new FileReader(file); } return new CSVReader(fileReader); }