@Test public void getReader_JsonContent() throws ImportException, IOException { try(Reader reader = importFileUtils.getReader(importFileJson)) { String readContent = IOUtils.toString(reader); assertEquals(importFileJsonContent, readContent); } }
public Reader getReader(File file) throws ImportException { try { InputStream inputStream = new FileInputStream(file); if (GzipUtils.isCompressedFilename(file.getName())) { inputStream = new GZIPInputStream(inputStream); } else if (FilenameUtils.getExtension(file.getName()).equals("zip")) { inputStream = new ZipInputStream(inputStream); ((ZipInputStream)inputStream).getNextEntry(); } return new InputStreamReader(inputStream, fileCharset); } catch (Exception e) { throw new ImportException(e); } }
ImportFileUtils { public Reader getReader(File file) throws ImportException { try { InputStream inputStream = new FileInputStream(file); if (GzipUtils.isCompressedFilename(file.getName())) { inputStream = new GZIPInputStream(inputStream); } else if (FilenameUtils.getExtension(file.getName()).equals("zip")) { inputStream = new ZipInputStream(inputStream); ((ZipInputStream)inputStream).getNextEntry(); } return new InputStreamReader(inputStream, fileCharset); } catch (Exception e) { throw new ImportException(e); } } }
ImportFileUtils { public Reader getReader(File file) throws ImportException { try { InputStream inputStream = new FileInputStream(file); if (GzipUtils.isCompressedFilename(file.getName())) { inputStream = new GZIPInputStream(inputStream); } else if (FilenameUtils.getExtension(file.getName()).equals("zip")) { inputStream = new ZipInputStream(inputStream); ((ZipInputStream)inputStream).getNextEntry(); } return new InputStreamReader(inputStream, fileCharset); } catch (Exception e) { throw new ImportException(e); } }  }
ImportFileUtils { public Reader getReader(File file) throws ImportException { try { InputStream inputStream = new FileInputStream(file); if (GzipUtils.isCompressedFilename(file.getName())) { inputStream = new GZIPInputStream(inputStream); } else if (FilenameUtils.getExtension(file.getName()).equals("zip")) { inputStream = new ZipInputStream(inputStream); ((ZipInputStream)inputStream).getNextEntry(); } return new InputStreamReader(inputStream, fileCharset); } catch (Exception e) { throw new ImportException(e); } }  Collection<File> listImportFiles(String importDir); Reader getReader(File file); void setEligibleFileExtensions(String[] eligibleFileExtensions); void setFileCharset(String fileCharset); }
ImportFileUtils { public Reader getReader(File file) throws ImportException { try { InputStream inputStream = new FileInputStream(file); if (GzipUtils.isCompressedFilename(file.getName())) { inputStream = new GZIPInputStream(inputStream); } else if (FilenameUtils.getExtension(file.getName()).equals("zip")) { inputStream = new ZipInputStream(inputStream); ((ZipInputStream)inputStream).getNextEntry(); } return new InputStreamReader(inputStream, fileCharset); } catch (Exception e) { throw new ImportException(e); } }  Collection<File> listImportFiles(String importDir); Reader getReader(File file); void setEligibleFileExtensions(String[] eligibleFileExtensions); void setFileCharset(String fileCharset);  }