// ... public void catenate(String name, Path currentDirectory) { Path path = checkIfExists(name, currentDirectory); if (path != null && Files.isRegularFile(path) && Files.isReadable(path)) { Charset charset = Charset.forName("UTF-8"); try (BufferedReader bufferedReader = Files.newBufferedReader(path, charset)) { String line = null; while ((line = bufferedReader.readLine()) != null) System.out.println(line); } catch (IOException ioException) { System.out.println("Operation could not be performed !"+ioException.getMessage()); } } else System.out.format("Could not display the contents of file %s!%n",name); } // ...